Search: a069754 -id:a069754
|
|
A010051
|
|
Characteristic function of primes: 1 if n is prime, else 0.
|
|
+10
1174
|
|
|
0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Hardy and Wright prove that the real number 0.011010100010... is irrational. See Nasehpour link. - Michel Marcus, Jun 21 2018
The spectral components (excluding the zero frequency) of the Fourier transform of the partial sequences {a(j)} with j=1..n and n an even number, exhibit a remarkable symmetry with respect to the central frequency component at position 1 + n/4. See the Fourier spectrum of the first 2^20 terms in Links, Comments in A289777, and Conjectures in A001223 of Sep 01 2019. It also appears that the symmetry grows with n. - Andres Cicuttin, Aug 23 2020
|
|
REFERENCES
|
J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 3.
V. Brun, Über das Goldbachsche Gesetz und die Anzahl der Primzahlpaare, Arch. Mat. Natur. B, 34, no. 8, 1915.
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Oxford University Press, London, 1975.
Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 65.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = floor(cos(Pi*((n-1)! + 1)/n)^2) for n >= 2. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 07 2002
Let M(n) be the n X n matrix m(i, j) = 0 if n divides ij + 1, m(i, j) = 1 otherwise; then for n > 0 a(n) = -det(M(n)). - Benoit Cloitre, Jan 17 2003
a(n) = Sum_{d|gcd(n, A034386(n))} mu(d). [Brun]
a(n) = 1 if n has no divisors other than 1 and n, and 0 otherwise. - Jon Perry, Jul 02 2005
Dirichlet generating function: Sum_{n >= 1} a(n)/n^s = primezeta(s), where primezeta is the prime zeta function. - Franklin T. Adams-Watters, Sep 11 2005
a(n) = A051731((n + 1)! + 1, n) from Wilson's theorem: n is prime if and only if (n + 1)! is congruent to -1 mod n. - N-E. Fahssi, Jan 20 2009, Jan 29 2009
It appears that a(n) = (H(n)*H(n + 1)) mod n, where H(n) = n!*Sum_{k=1..n} 1/k = A000254(n). - Gary Detlefs, Sep 12 2010
Dirichlet generating function: log( Sum_{n >= 1} 1/(A112624(n)*n^s) ). - Mats Granvik, Apr 13 2011
(n - 1)*a(n) = ( (2*n + 1)!! * Sum_{k=1..n}(1/(2*k + 1))) mod n, n > 2. - Gary Detlefs, Oct 07 2011
a(n) = abs(F(n)) - abs(F(n)-1/2) - abs(F(n)-1) + abs(f(n)-3/2), where F(n) = Sum_{m=2..n+1} (abs(1 - (n mod m)) - abs(1/2 - (n mod m)) + 1/2), n > 0. F(n) = 1 if n is prime, > 1 otherwise, except F(1) = 0. a(n) = 1 if F(n) = 1, 0 otherwise. - Timothy Hopper, Jun 16 2015
G.f.: A(x) = Sum_{n>=1} x^A000040(n) = B(x)*(1 - x), where B(x) is the g.f. for A000720.
a(n) = floor(2/A000005(n)), for n>1. (End)
Decimal expansion of Sum_{k>=1} (1/10)^prime(k) = 9 * Sum_{k>=1} pi(k)/10^(k+1), where pi(k) = A000720(k). - Amiram Eldar, Aug 11 2020
a(n) = 1 - ceiling((2/n) * Sum_{k=2..floor(sqrt(n))} floor(n/k)-floor((n-1)/k)), n>1. - Gary Detlefs, Sep 08 2023
|
|
MAPLE
|
A010051:= n -> if isprime(n) then 1 else 0 fi;
|
|
MATHEMATICA
|
Table[PrimePi[n] - PrimePi[n-1], {n, 50}] (* G. C. Greubel, Jan 05 2017 *)
|
|
PROG
|
(Magma) s:=[]; for n in [1..100] do if IsPrime(n) then s:=Append(s, 1); else s:=Append(s, 0); end if; end for; s;
(Magma) [IsPrime(n) select 1 else 0: n in [1..100]]; // Bruno Berselli, Mar 02 2011
(PARI) { for (n=1, 20000, if (isprime(n), a=1, a=0); write("b010051.txt", n, " ", a); ) } \\ Harry J. Smith, Jun 15 2009
(Haskell)
import Data.List (unfoldr)
a010051 :: Integer -> Int
a010051 n = a010051_list !! (fromInteger n-1)
a010051_list = unfoldr ch (1, a000040_list) where
ch (i, ps'@(p:ps)) = Just (fromEnum (i == p),
(i + 1, if i == p then ps else ps'))
(Python)
from sympy import isprime
|
|
CROSSREFS
|
Characteristic function of A000040.
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A035026
|
|
Number of times that i and 2n-i are both prime, for i = 1, ..., 2n-1.
|
|
+10
19
|
|
|
0, 1, 1, 2, 3, 2, 3, 4, 4, 4, 5, 6, 5, 4, 6, 4, 7, 8, 3, 6, 8, 6, 7, 10, 8, 6, 10, 6, 7, 12, 5, 10, 12, 4, 10, 12, 9, 10, 14, 8, 9, 16, 9, 8, 18, 8, 9, 14, 6, 12, 16, 10, 11, 16, 12, 14, 20, 12, 11, 24, 7, 10, 20, 6, 14, 18, 11, 10, 16, 14, 15, 22, 11, 10, 24, 8, 16, 22, 9, 16, 20, 10
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
a(n) is the convolution of terms 1 to 2n of the characteristic function of the primes, A010051, with itself. Related to Goldbach's conjecture that every even number can be expressed as the sum of two primes. - T. D. Noe, Aug 01 2002
Total number of printer jobs in all possible schedules for n time slots in the first-come-first-served (FCFS) policy.
First occurrence of k: 1, 2, 4, 5, 8, 11, 12, 17, 18, 37, 24, 53, 30, 89, 39, 71, 42, 101, 45, 179, 57, 137, 72, 193, 60, 233, ..., .
Conjectured last occurrence of k: 1, 3, 6, 19, 34, 31, 64, 61, 76, 79, 94, 83, 166, 199, 136, 181, 184, 229, 244, 271, 316, 277, 346, 313, 301, 293, ..., .
Conjectured number occurrences of k: 1, 2, 2, 3, 6, 3, 8, 4, 7, 5, 11, 5, 11, 8, 10, 3, 17, 7, 16, 3, 13, 8, 21, 4, 12, 3, 22, 7, 20, 8, 15, ..., .
Records: 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 26, 28, 38, 42, 48, 54, 60, 64, 82, 88, 102, 104, 114, 116, 136, 146, 152, 166, 182, ..., .
(End)
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
local a, i ;
a := 0 ;
for i from 1 to 2*n-1 do
if isprime(i) and isprime(2*n-i) then
a := a+1 ;
end if;
end do:
a ;
|
|
MATHEMATICA
|
For[lst={}; n=1, n<=100, n++, For[cnt=0; i=1, i<=2n-1, i++ If[PrimeQ[i]&&PrimeQ[2n-i], cnt++ ]]; AppendTo[lst, cnt]]; lst
f[n_] := Block[{c = Boole@ PrimeQ[ n/2], p = 2}, While[ 2p < n, If[ PrimeQ[n - p], c += 2]; p = NextPrime@ p]; c];; Array[ f[ 2#] &, 90] (* Robert G. Wilson v, Dec 15 2016 *)
|
|
PROG
|
(Haskell)
a035026 n = sum $ map (a010051 . (2 * n -)) $
takeWhile (< 2 * n) a000040_list
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
Gordon R. Bower (siegmund(AT)mosquitonet.com)
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A071574
|
|
If n = k-th prime, a(n) = 2*a(k) + 1; if n = k-th nonprime, a(n) = 2*a(k).
|
|
+10
10
|
|
|
0, 1, 3, 2, 7, 6, 5, 4, 14, 12, 15, 10, 13, 8, 28, 24, 11, 30, 9, 20, 26, 16, 29, 56, 48, 22, 60, 18, 25, 40, 31, 52, 32, 58, 112, 96, 21, 44, 120, 36, 27, 50, 17, 80, 62, 104, 57, 64, 116, 224, 192, 42, 49, 88, 240, 72, 54, 100, 23, 34, 61, 160, 124, 208, 114, 128, 19
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
The recursion start is implicit in the rule, since the rule demands that a(1)=2*a(1). All other terms are defined through terms for smaller indices until a(1) is reached.
a(n) is a bijective mapping from the positive integers to the nonnegative integers. Given the value of a(n), you can get back to n using the following algorithm:
Start with an initial value of k=1 and write a(n) in binary representation. Then for each bit, starting with the most significant one, do the following: - if the bit is 1, replace k by the k-th prime - if the bit is 0, replace k by the k-th nonprime. After you processed the last (i.e. least significant) bit of a(n), you've got n=k.
Example: From a(n) = 12 = 1100_2, you get 1->2->3=>6=>10; a(10)=12. Here each "->" is a step due to binary digit 1; each "=>" is a step due to binary digit 0.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
1 is the 1st nonprime, so a(1) = 2*a(1), therefore a(1) = 0.
2 is the 1st prime, so a(2) = 2*a(1)+1 = 2*0+1 = 1.
4 is the 2nd nonprime, so a(4) = 2*a(2) = 2*1 = 2.
|
|
MATHEMATICA
|
a[1] = 0 a[n_] := If[PrimeQ[n], 2*a[PrimePi[n]] + 1, 2*a[n - PrimePi[n]]]
|
|
PROG
|
(Haskell)
a071574 1 = 0
a071574 n = 2 * a071574 (if j > 0 then j + 1 else a049084 n) + 1 - signum j
where j = a066246 n
(Scheme, with memoizing definec-macro)
(PARI) first(n) = my(res = vector(n), p); for(x=2, n, p=isprime(x); res[x]=2*res[x*!p-(-1)^p*primepi(x)]+p); res \\ Iain Fox, Oct 19 2018
|
|
CROSSREFS
|
Compare also to the permutation A246377.
|
|
KEYWORD
|
|
|
AUTHOR
|
Christopher Eltschka (celtschk(AT)web.de), May 31 2002
|
|
STATUS
|
approved
|
|
|
|
|
A061007
|
|
a(n) = -(n-1)! mod n.
|
|
+10
9
|
|
|
0, 1, 1, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
In particular, this is identical to the isprime function A010051 except for a(4) = 2 instead of 0. This is equivalent to Wilson's theorem, (n-1)! == -1 (mod n) iff n is prime. If n = p*q with p, q > 1, then p, q < n-1 and (n-1)! will contain the two factors p and q, unless p = q = 2 (if p = q > 2 then also 2p < n-1, so there are indeed two factors p in (n-1)!), whence (n-1)! == 0 (mod n). - M. F. Hasler, Jul 19 2024
|
|
LINKS
|
|
|
FORMULA
|
a(4) = 2, a(p) = 1 for p prime, a(n) = 0 otherwise. Apart from n = 4, a(n) = A010051(n) = A061006(n)/(n-1).
|
|
EXAMPLE
|
a(4) = 2 since -(4 - 1)! = -6 = 2 mod 4.
a(5) = 1 since -(5 - 1)! = -24 = 1 mod 5.
a(6) = 0 since -(6 - 1)! = -120 = 0 mod 6.
|
|
MATHEMATICA
|
|
|
PROG
|
(Python)
from sympy import isprime
|
|
CROSSREFS
|
Positive for all but the first term of A046022.
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A211005
|
|
Pair (i, j) where i = number of adjacent nonprimes and j = number of adjacent primes.
|
|
+10
4
|
|
|
1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 5, 1, 1, 1, 5, 1, 3, 1, 1, 1, 3, 1, 5, 1, 5, 1, 1, 1, 5, 1, 3, 1, 1, 1, 5, 1, 3, 1, 5, 1, 7, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 13, 1, 3, 1, 5, 1, 1, 1, 9, 1, 1, 1, 5, 1, 5, 1, 3, 1, 5, 1, 5, 1, 1, 1, 9, 1, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
----------------------------------------------------------
. Array from Number of Number of
----------------------------------------------------------
1 1; 1 0 1
2 2, 3; 0 2 2
3 4; 1 0 1
4 5; 0 1 1
5 6; 1 0 1
6 7; 0 1 1
7 8, 9, 10; 3 0 3
8 11; 0 1 1
9 12; 1 0 1
10 13; 0 1 1
11 14, 15, 16; 3 0 3
12 17; 0 1 1
13 18; 1 0 1
14 19; 0 1 1
15 20, 21, 22; 3 0 3
16 23; 0 1 1
17 24, 25, 26, 27, 28; 5 0 5
18 29; 0 1 1
19 30; 1 0 1
20 31; 0 1 1
|
|
MATHEMATICA
|
A211005[upto_]:=Map[Length, Most[Split[PrimeQ[Range[upto]]]]];
|
|
PROG
|
(Haskell)
import Data.List (group)
a211005 n = a211005_list !! (n-1)
a211005_list = map length $ group a069754_list
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.012 seconds
|