cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-8 of 8 results.

A124077 Indices of the primes in A072762; b(i=a(n)) is prime, b(i) coded as binary word of length=i with k-th bit set iff k is prime (1<=k<=i).

Original entry on oeis.org

3, 5, 7, 29, 73, 2131, 4211
Offset: 1

Views

Author

Anton Vrba (antonvrba(AT)yahoo.com), Nov 24 2006

Keywords

Comments

A072762(4211) tested as PRP, others certified primes.
A072762(4211) is prime. a(8) > 200000. - Jason Yuen, Oct 26 2024

Examples

			a(3)=7 as A072762(7)=53 and 53 is prime! Also, the binary concatenation of the first a(n) terms of A010051 is prime. E.g. the first 7 term concatenation is binary 0110101 = decimal 53 and is prime!
		

Crossrefs

Programs

  • Mathematica
    F[j_] := PrimeQ[Numerator[ Sum[ 1/2^Prime[k], {k, 1, j} ] ]] ; Prime[Select[Range[600], F]]

A101333 A081254-A072762.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 8, 16, 32, 65, 130, 260, 520, 1040, 2080, 4161, 8322, 16644, 33288, 66577, 133154, 266309, 532618, 1065236, 2130472, 4260944
Offset: 0

Views

Author

Jorge Coveiro, Dec 24 2004

Keywords

Comments

Very close to 2^n

Extensions

Comments moved to new sequence A195904 by Jeremy Gardiner, Sep 25 2011

A010051 Characteristic function of primes: 1 if n is prime, else 0.

Original entry on oeis.org

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
Offset: 1

Views

Author

Keywords

Comments

The following sequences all have the same parity (with an extra zero term at the start of a(n)): a(n), A061007, A035026, A069754, A071574. - Jeremy Gardiner, Aug 09 2002
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.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 132.

Crossrefs

Cf. A051006 (constant 0.4146825... (base 10) = 0.01101010001010001010... (base 2)), A001221 (inverse Moebius transform), A143519, A156660, A156659, A156657, A059500, A053176, A059456, A072762.
First differences of A000720, so A000720 gives partial sums.
Column k=1 of A117278.
Characteristic function of A000040.
Cf. A008683.

Programs

  • 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'))
    -- Reinhard Zumkeller, Apr 17 2012, Sep 15 2011
    
  • 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
    
  • Maple
    A010051:= n -> if isprime(n) then 1 else 0 fi;
  • Mathematica
    Table[ If[ PrimeQ[n], 1, 0], {n, 105}] (* Robert G. Wilson v, Jan 15 2005 *)
    Table[Boole[PrimeQ[n]], {n, 105}] (* Alonso del Arte, Aug 09 2011 *)
    Table[PrimePi[n] - PrimePi[n-1], {n,50}] (* G. C. Greubel, Jan 05 2017 *)
  • PARI
    a(n)=isprime(n) \\ Charles R Greathouse IV, Apr 16 2011
    
  • Python
    from sympy import isprime
    def A010051(n): return int(isprime(n)) # Chai Wah Wu, Jan 20 2022

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
n >= 2, a(n) = floor(phi(n)/(n - 1)) = floor(A000010(n)/(n - 1)). - Benoit Cloitre, Apr 11 2003
a(n) = Sum_{d|gcd(n, A034386(n))} mu(d). [Brun]
a(m*n) = a(m)*0^(n - 1) + a(n)*0^(m - 1). - Reinhard Zumkeller, Nov 25 2004
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) = (n-1)!^2 mod n. - Franz Vrabec, Jun 24 2006
a(n) = A047886(n, 1). - Reinhard Zumkeller, Apr 15 2008
Equals A051731 (the inverse Möbius transform) * A143519. - Gary W. Adamson, Aug 22 2008
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
a(n) = A166260/A001477. - Mats Granvik, Oct 10 2009
a(n) = 0^A070824, where 0^0=1. - Mats Granvik, Gary W. Adamson, Feb 21 2010
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
a(n) = A100995(n) - sqrt(A100995(n)*A193056(n)). - Mats Granvik, Jul 15 2011
a(n) * (2 - n mod 4) = A151763(n). - Reinhard Zumkeller, Oct 06 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
For n > 1, a(n) = floor(1/A001222(n)). - Enrique Pérez Herrero, Feb 23 2012
a(n) = mu(n) * Sum_{d|n} mu(d)*omega(d), where mu is A008683 and omega A001222 or A001221 indistinctly. - Enrique Pérez Herrero, Jun 06 2012
a(n) = A003418(n+1)/A003418(n) - A217863(n+1)/A217863(n) = A014963(n) - A072211(n). - Eric Desbiaux, Nov 25 2012
For n > 1, a(n) = floor(A014963(n)/n). - Eric Desbiaux, Jan 08 2013
a(n) = ((abs(n-2))! mod n) mod 2. - Timothy Hopper, May 25 2015
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
For n > 4, a(n) = (n-2)! mod n. - Thomas Ordowski, Jul 24 2016
From Ilya Gutkovskiy, Jul 24 2016: (Start)
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)
a(n) = pi(n) - pi(n-1) = A000720(n) - A000720(n-1), for n>=1. - G. C. Greubel, Jan 05 2017
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
a(n) = Sum_{d|n} mu(d)*omega(n/d), where mu = A008683 and omega = A001221. - Ridouane Oudra, Apr 12 2025
a(n) = 0 if (n^2 - 3*n + 2) * A000203(n) - 8 * A002127(n) > 0 else 1 (n>2, see Craig link). - Bill McEachen, Jul 04 2025

A118255 a(1)=1, then a(n)=2*a(n-1) if n is prime, a(n)=2*a(n-1)+1 if n not prime.

Original entry on oeis.org

1, 2, 4, 9, 18, 37, 74, 149, 299, 599, 1198, 2397, 4794, 9589, 19179, 38359, 76718, 153437, 306874, 613749, 1227499, 2454999, 4909998, 9819997, 19639995, 39279991, 78559983, 157119967, 314239934, 628479869, 1256959738, 2513919477, 5027838955, 10055677911
Offset: 1

Views

Author

Pierre CAMI, Apr 19 2006

Keywords

Comments

In base 2 a(n) is the concatenation for i=1 to n of A005171(i).

Examples

			a(2) = 2*1 = 2 as 2 is prime;
a(3) = 2*2 = 4 as 3 is prime;
a(4) = 2*4+1 = 9 as 4 is composite;
a(5) = 2*9 = 18 as 5 is prime.
		

Crossrefs

Programs

  • Maple
    f:=proc(n) option remember; if n=1 then RETURN(1); fi; if isprime(n) then 2*f(n-1) else 2*f(n-1)+1; fi; end; # N. J. A. Sloane
  • Mathematica
    nxt[{n_,a_}]:={n+1,If[PrimeQ[n+1],2a,2a+1]}; Transpose[NestList[nxt,{1,1},40]][[2]] (* Harvey P. Dale, Jan 22 2015 *)
    Array[FromDigits[#, 2] &@ Array[Boole[! PrimeQ@ #] &, #] &, 34] (* Michael De Vlieger, Nov 01 2016 *)
  • Python
    from sympy import isprime, prime
    def a(n): return int("".join(str(1-isprime(i)) for i in range(1, n+1)), 2)
    print([a(n) for n in range(1, 35)]) # Michael S. Branicky, Jan 10 2022
    
  • Python
    # faster version for initial segment of sequence
    from sympy import isprime
    from itertools import count, islice
    def agen(): # generator of terms
        an = 0
        for k in count(1):
            an = 2 * an + int(not isprime(k))
            yield an
    print(list(islice(agen(), 34))) # Michael S. Branicky, Jan 10 2022

Formula

a(n) = floor(k * 2^n) where k = 0.585317... = 1 - A051006. [Charles R Greathouse IV, Dec 27 2011]
From Ridouane Oudra, Aug 26 2019: (Start)
a(n) = 2^n - 1 - (1/2)*(pi(n) + Sum_{i=1..n} 2^(n-i)*pi(i)), where pi = A000720
a(n) = A000225(n) - A072762(n). (End)

Extensions

Corrected by Omar E. Pol, Nov 08 2007
Corrections verified by N. J. A. Sloane, Nov 17 2007

A100634 a(n) is the decimal equivalent of the binary number whose k-th least significant bit is 1 iff k is a prime number and k <= n.

Original entry on oeis.org

0, 2, 6, 6, 22, 22, 86, 86, 86, 86, 1110, 1110, 5206, 5206, 5206, 5206, 70742, 70742, 332886, 332886, 332886, 332886, 4527190, 4527190, 4527190, 4527190, 4527190, 4527190, 272962646, 272962646, 1346704470, 1346704470, 1346704470, 1346704470, 1346704470
Offset: 1

Views

Author

Joseph Biberstine (jrbibers(AT)indiana.edu), Dec 02 2004

Keywords

Comments

1 is not considered prime. If 1 were to be considered prime, each term would be incremented by 1.

Examples

			a(5) = 22 because the k-th least significant bits 1,2,3,4,5 are prime for 2,3,5 and not prime for 1,4. So k=1->0, k=2->1, k=3->1, k=4->0 and k=5->1 gives the bit sequence 10110, which is 2 + 4 + 16 = 22 in its decimal expansion.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, 0,
          a(n-1)+`if`(isprime(n), 2^(n-1), 0))
        end:
    seq(a(n), n=1..35);  # Alois P. Heinz, Apr 01 2024
  • Mathematica
    Table[FromDigits[Reverse[Table[If[PrimeQ[k] == True, 1, 0], {k, 1, N}]], 2], {N, 1, 40}]
    FoldList[Plus, If[PrimeQ[#], 2^#/2, 0] & /@ Range@40] (* David Dewan, Apr 01 2024 *)
  • PARI
    Sum(an)={ L=#binary(an)-1; k=2; s=0; pow2=2;
    forstep(j=L, 2, -1,
    if(isprime(k), s+=pow2);
    k++; pow2*=2);
    return(s) };
      n=1; an=0;
    while(an<=1346704470,
      an+=Sum(an); print1(an,", "); n++;
      while(!isprime(n), print1(an,", "); n++);
      an=2^(n-1)
    ) \\ Washington Bomfim, Jan 17 2011

A121240 Numerator of sum_{k=1..n} 1/2^prime(k).

Original entry on oeis.org

1, 3, 13, 53, 849, 3397, 54353, 217413, 3478609, 222630977, 890523909, 56993530177, 911896482833, 3647585931333, 58361374901329, 3735127993685057, 239048191595843649, 956192766383374597, 61196337048535974209
Offset: 1

Views

Author

Alexander Adamchuk, Aug 22 2006

Keywords

Comments

a(n) is prime for n = {2, 3, 4, 10, 21, 321,..} where it takes the values {3, 13, 53, 222630977, ...}.
The prime constant A051006 = 0.414682509.. is limit(n->infinity) a(n)/2^prime(n) .

Crossrefs

Cf. A034785 (denominators), A072762, A051006, A010051.

Programs

  • Mathematica
    Table[Numerator[Sum[1/2^Prime[k],{k,1,n}]],{n,1,30}]
    Accumulate[1/2^Prime[Range[30]]]//Numerator (* Harvey P. Dale, Aug 11 2021 *)

Formula

a(n) = Numerator[ Sum[ 1/2^Prime[k], {k,1,n} ] ]. a(n) = A072762[ Prime[n] ].

A333392 a(0) = 1; thereafter a(n) = 2^(prime(n)-1) + Sum_{k=1..n} 2^(prime(n)-prime(k)).

Original entry on oeis.org

1, 3, 7, 29, 117, 1873, 7493, 119889, 479557, 7672913, 491066433, 1964265733, 125713006913, 2011408110609, 8045632442437, 128730119078993, 8238727621055553, 527278567747555393, 2109114270990221573, 134983313343374180673, 2159733013493986890769, 8638932053975947563077
Offset: 0

Views

Author

Ilya Gutkovskiy, Mar 18 2020

Keywords

Examples

			a(7) = 119889 (in base 10) = 11101010001010001 (in base 2).
                             ||| | |   | |   |
                             123 5 7  1113  17
		

Crossrefs

Programs

  • Mathematica
    a[0] = 1; a[n_] := 2^(Prime[n] - 1) + Sum[2^(Prime[n] - Prime[k]), {k, 1, n}]; Table[a[n], {n, 0, 21}]
  • PARI
    a(n) = if (n==0, 1, 2^(prime(n)-1) + sum(k=1, n, 2^(prime(n)-prime(k)))); \\ Michel Marcus, Mar 18 2020

Formula

a(n) = floor(c * 2^prime(n)) for n > 0, where c = 0.91468250985... = 1/2 + A051006.

A180933 Initial segments of A010051, interpreted as binary numbers, that are prime.

Original entry on oeis.org

3, 13, 53, 222630977, 3916565571106302349381
Offset: 1

Views

Author

Yves Debeuret, Sep 26 2010

Keywords

Comments

The main entry for this sequence is A124077.
The binary expansion of all terms of this sequence is some initial segment of 1101010001010001....
Next terms have 642, 1268, ... decimal digits.
Primes in an initial portion of the infinite binary string built from the prime characteristic function A010051. - R. J. Mathar, Sep 26 2010

Examples

			a(2) = 13, which is 1101 in binary, corresponding to the characteristic sequence of the primes: 2 is prime, 3 is prime, 4 is composite, 5 is prime.
		

Crossrefs

Subset of A072762.

Programs

  • Maple
    A072762 := proc(n) option remember; if n =1 then return 0; elif n =2 then return 1; end if; if isprime(n) then 2*procname(n-1)+1 ; else 2*procname(n-1) ; end if; end proc:
    for n from 1 to 300 do p := A072762(n) ; if isprime(p) then printf("%d,",p) ; end if; end do: # R. J. Mathar, Sep 26 2010
  • PARI
    my(n=1);for(k=3,1e4,n+=n+isprime(k);if(ispseudoprime(n),print1(n", ")))

Formula

A000040 INTERSECT A072762. a(n) = A072762(A124077(n)). - R. J. Mathar, Sep 26 2010 [corrected by Jason Yuen, Oct 14 2024]

Extensions

Extended and rewritten by Charles R Greathouse IV, Sep 27 2010
Showing 1-8 of 8 results.