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.

Previous Showing 11-20 of 48 results. Next

A093513 Transform of the prime sequence by the Rule89 cellular automaton.

Original entry on oeis.org

1, 3, 4, 9, 10, 15, 16, 21, 22, 25, 26, 27, 28, 33, 34, 35, 36, 39, 40, 45, 46, 49, 50, 51, 52, 55, 56, 57, 58, 63, 64, 65, 66, 69, 70, 75, 76, 77, 78, 81, 82, 85, 86, 87, 88, 91, 92, 93, 94, 95, 96, 99, 100, 105, 106, 111, 112, 115, 116, 117, 118, 119, 120, 121, 122, 123
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

As described in A051006, a monotonic sequence can be mapped into a fractional real. Then the binary digits of that real can be treated (transformed) by an elementary cellular automaton. Taken resulted sequence of binary digits as a fractional real, it can be mapped back into a sequence, as in A092855.
For n > 3, the a(n) are those missed by the following construct. Start with b(0) = 1. If b(n-1) is not prime, b(n) is the next prime, otherwise b(n) is the next integer. This yields 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20, 23, ... with missed values a(n) = 9, 10, 15, 16, 21, 22, .... Interestingly, b(n) appears to be A093515 for n>0. This fits with Karttunen's observation at A093515. - Bill McEachen, Jun 12 2024

Crossrefs

Programs

  • PARI
    {ca_tr(ca,v)= /* Calculates the Cellular Automaton transform of the vector v by the rule ca */
    local(cav=vector(8),a,r=[],i,j,k,l,po,p=vector(3));
    a=binary(min(255,ca));k=matsize(a)[2];forstep(i=k,1,- 1,cav[k-i+1]=a[i]);
    j=0;l=matsize(v)[2];k=v[l];po=1;
    for(i=1,k+2,j*=2;po=isin(i,v,l,po);j=(j+max(0,sign(po)))% 8;if(cav[j+1],r=concat(r,i)));
    return(r) /* See the function "isin" at A092875 */}

A072762 n coded as binary word of length=n with k-th bit set iff k is prime (1<=k<=n), decimal value.

Original entry on oeis.org

0, 1, 3, 6, 13, 26, 53, 106, 212, 424, 849, 1698, 3397, 6794, 13588, 27176, 54353, 108706, 217413, 434826, 869652, 1739304, 3478609, 6957218, 13914436, 27828872, 55657744, 111315488, 222630977, 445261954, 890523909, 1781047818, 3562095636, 7124191272
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 08 2002

Keywords

Comments

a(n) is odd iff n is prime.
a(p) where p is prime is the numerator of Sum_{q <= p} 1/2^q where the sum is over primes up to p. - Alexander Adamchuk, Aug 22 2006
The n-th approximation to the Prime Constant is given by a(n)/2^n. - Anton Vrba (antonvrba(AT)yahoo.com), Nov 24 2006

Examples

			a(6) = '011010' = (((0*2+1)*2+1)*2*2+1)*2 = 26.
a(7) = '0110101' = (((0*2+1)*2+1)*2*2+1)*2*2+1 = 53.
a(8) = '01101010' = ((((0*2+1)*2+1)*2*2+1)*2*2+1)*2 = 106.
		

Crossrefs

Programs

  • Haskell
    a072762 n = foldl (\v d -> 2*v + d) 0 $ map a010051 [1..n]
    -- Reinhard Zumkeller, Sep 17 2011
  • Maple
    a:= proc(n) option remember;
          `if`(n<2, 0, 2 * a(n-1) + `if`(isprime(n), 1, 0))
        end:
    seq(a(n), n=1..40);  #  Alois P. Heinz, Jan 18 2011
  • Mathematica
    a[1] = 0; a[n_] := a[n] = 2*a[n-1] + Boole[PrimeQ[n]]; Table[a[n], {n, 1, 31}] (* Jean-François Alcover, Jun 14 2013 *)
    nxt[{n_,a_}]:={n+1,Boole[PrimeQ[n+1]]+2a}; Transpose[NestList[nxt,{1,0},30]][[2]] (* Harvey P. Dale, Jan 07 2015 *)
  • PARI
    an=0; print1(an,", "); for(n=2,31, an=2*an+isprime(n); print1(an,", ")) \\ Washington Bomfim, Jan 18 2011
    
  • PARI
    a(n)=my(s=1,p=2);forprime(q=3,n,s=s<<(q-p)+1;p=q);s<<(n-p) \\ Charles R Greathouse IV, Jun 03 2013
    

Formula

a(1) = 0 and a(n) = a(n-1)*2 + A010051(n) for n>1.
a(n) = (1/2)*(pi(n) + Sum_{i=1..n} 2^(n-i)*pi(i)), where pi = A000720. - Ridouane Oudra, Aug 26 2019
a(n) = floor(c*2^n), where c = A051006 is the prime constant. - Lorenzo Sauras Altuzarra, Jan 03 2023

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

A092857 Representation of 1/sqrt(2*Pi) by an infinite sequence.

Original entry on oeis.org

2, 3, 6, 7, 11, 16, 20, 22, 25, 26, 29, 30, 31, 32, 34, 36, 41, 42, 44, 45, 48, 50, 55, 59, 60, 62, 67, 68, 69, 70, 71, 72, 75, 77, 78, 81, 82, 83, 84, 88, 90, 99, 101, 102, 103, 105, 107, 109, 110, 111, 115, 116, 117, 121, 123, 124, 125, 126, 127, 128, 129, 130, 132, 135
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

Any real number in the range (0,1), having infinite number of nonzero binary digits, can be represented by a monotonic infinite sequence, such a way that: n is in the sequence iff the n-th digit in the fraction part of the number is 1. See also A092855.
An example for the inverse mapping is A051006.

Crossrefs

Programs

  • PARI
    {/* mtinv(x)= /*Returns the inverse binary mapping of x into a monotonic sequence */ local(z,v=[],r=[],l); z=frac(x);v=binary(z)[2];l=matsize(v)[2]; for(i=1,l,if(v[i]==1,r=concat(r,i)));return(r)} }

A093510 Transform of the prime sequence by the Rule30 cellular automaton.

Original entry on oeis.org

2, 3, 6, 8, 9, 11, 12, 14, 15, 17, 18, 20, 21, 23, 24, 25, 29, 30, 32, 33, 37, 38, 39, 41, 42, 44, 45, 47, 48, 49, 53, 54, 55, 59, 60, 62, 63, 67, 68, 69, 71, 72, 74, 75, 79, 80, 81, 83, 84, 85, 89, 90, 91, 97, 98, 99, 101, 102, 104, 105, 107, 108, 110, 111, 113, 114, 115
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

As described in A051006, a monotonic sequence can be mapped into a fractional real. Then the binary digits of that real can be treated (transformed) by an elementary cellular automaton. Taken resulted sequence of binary digits as a fractional real, it can be mapped back into a sequence, as in A092855.

Crossrefs

Programs

  • PARI
    {ca_tr(ca,v)= /* Calculates the Cellular Automaton transform of the vector v by the rule ca */
    local(cav=vector(8),a,r=[],i,j,k,l,po,p=vector(3));
    a=binary(min(255,ca));k=matsize(a)[2];forstep(i=k,1,- 1,cav[k-i+1]=a[i]);
    j=0;l=matsize(v)[2];k=v[l];po=1;
    for(i=1,k+2,j*=2;po=isin(i,v,l,po);j=(j+max(0,sign(po)))% 8;if(cav[j+1],r=concat(r,i)));
    return(r) /* See the function "isin" at A092875 */}

A093511 Transform of the prime sequence by the Rule45 cellular automaton.

Original entry on oeis.org

1, 3, 5, 6, 7, 8, 10, 12, 13, 14, 16, 18, 19, 20, 22, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 40, 42, 43, 44, 46, 48, 50, 51, 52, 54, 56, 57, 58, 60, 61, 62, 64, 65, 66, 68, 70, 72, 73, 74, 76, 77, 78, 80, 82, 84, 86, 87, 88, 90, 92, 93, 94, 95, 96, 98, 100, 102, 103, 104
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

As described in A051006, a monotonic sequence can be mapped into a fractional real. Then the binary digits of that real can be treated (transformed) by an elementary cellular automaton. If we take the resulting sequence of binary digits as a fractional real, it can be mapped back into a sequence, as in A092855.
Conjecture: For n > 3, the a(n) correspond to the following construct (in numerical order). a(n) terms include "bookend" values at every prime p + 1 (6,8,12,14,18,20,...). Additionally, the values between the bookends are included, unless adjacent to non-"twin composite" bookends. For example, consider bookends 6 and 8. There is only a single value 7 between these, so it is included. This means terms 6, 7 and 8 are included. Consider bookends 89 + 1, 97 + 1. Ignoring 91 and 97 adjacencies, values 92 through 96 are included. This means terms 90, 92-96 and 98 are included. - Bill McEachen, Jun 12 2024

Crossrefs

Programs

  • PARI
    {ca_tr(ca,v)= /* Calculates the Cellular Automaton transform of the vector v by the rule ca */
    local(cav=vector(8),a,r=[],i,j,k,l,po,p=vector(3));
    a=binary(min(255,ca));k=matsize(a)[2];forstep(i=k,1,- 1,cav[k-i+1]=a[i]);
    j=0;l=matsize(v)[2];k=v[l];po=1;
    for(i=1,k+2,j*=2;po=isin(i,v,l,po);j=(j+max(0,sign(po)))% 8;if(cav[j+1],r=concat(r,i)));
    return(r) /* See the function "isin" at A092875 */}

A093512 Transform of the prime sequence by the Rule73 cellular automaton.

Original entry on oeis.org

1, 3, 4, 10, 16, 22, 26, 27, 28, 34, 35, 36, 40, 46, 50, 51, 52, 56, 57, 58, 64, 65, 66, 70, 76, 77, 78, 82, 86, 87, 88, 92, 93, 94, 95, 96, 100, 106, 112, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 130, 134, 135, 136, 142, 143, 144, 145, 146, 147, 148
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

As described in A051006, a monotonic sequence can be mapped into a fractional real. Then the binary digits of that real can be treated (transformed) by an elementary cellular automaton. Taken resulted sequence of binary digits as a fractional real, it can be mapped back into a sequence, as in A092855.

Crossrefs

Programs

  • PARI
    {ca_tr(ca,v)= /* Calculates the Cellular Automaton transform of the vector v by the rule ca */
    local(cav=vector(8),a,r=[],i,j,k,l,po,p=vector(3));
    a=binary(min(255,ca));k=matsize(a)[2];forstep(i=k,1,- 1,cav[k-i+1]=a[i]);
    j=0;l=matsize(v)[2];k=v[l];po=1;
    for(i=1,k+2,j*=2;po=isin(i,v,l,po);j=(j+max(0,sign(po)))% 8;if(cav[j+1],r=concat(r,i)));
    return(r) /* See the function "isin" at A092875 */}

A093514 Transform of the prime sequence by the Rule90 cellular automaton.

Original entry on oeis.org

2, 3, 4, 9, 11, 15, 17, 21, 23, 25, 29, 33, 37, 39, 41, 45, 47, 49, 53, 55, 59, 63, 67, 69, 71, 75, 79, 81, 83, 85, 89, 91, 97, 99, 101, 105, 107, 111, 113, 115, 127, 129, 131, 133, 137, 141, 149, 153, 157, 159, 163, 165, 167, 169, 173, 175, 179, 183, 191, 195, 197, 201
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

As described in A051006, a monotonic sequence can be mapped into a fractional real. Then the binary digits of that real can be treated (transformed) by an elementary cellular automaton. Taken resulted sequence of binary digits as a fractional real, it can be mapped back into a sequence, as in A092855.
n is in this sequence if either n-2 OR n is prime but not both. Similar simple propositional rules can be given for all "RuleXXX" transforms of primes (or any strictly monotone sequence with a well-defined characteristic function) because the idea in these sequences is to take the characteristic function, consider it as an infinite binary word, apply one generation of some one-dimensional cellular automaton rule "XXX" to it and define the new sequence by this characteristic function. - Antti Karttunen, Apr 22 2004
For example, 2 is included because 0 is not prime, but 2 is. 3 is included because 1 is not prime, but 3 is. 4 is included because 2 is prime, although 4 is not. 5 is not included because both 3 and 5 are primes, 9 is included because 7 is prime, but 9 is not.

Crossrefs

Characteristic function for this sequence is A010051(n-2) + A010051(n) (modulo 2). Naturally none of the terms of A006512 occur here.

Programs

  • PARI
    {ca_tr(ca,v)= /* Calculates the Cellular Automaton transform of the vector v by the rule ca */
    local(cav=vector(8),a,r=[],i,j,k,l,po,p=vector(3));
    a=binary(min(255,ca));k=matsize(a)[2];forstep(i=k,1,- 1,cav[k-i+1]=a[i]);
    j=0;l=matsize(v)[2];k=v[l];po=1;
    for(i=1,k+2,j*=2;po=isin(i,v,l,po);j=(j+max(0,sign(po)))% 8;if(cav[j+1],r=concat(r,i)));
    return(r) /* See the function "isin" at A092875 */}

A093516 Transform of the prime sequence by the Rule137 cellular automaton.

Original entry on oeis.org

1, 3, 10, 16, 22, 26, 27, 28, 34, 35, 36, 40, 46, 50, 51, 52, 56, 57, 58, 64, 65, 66, 70, 76, 77, 78, 82, 86, 87, 88, 92, 93, 94, 95, 96, 100, 106, 112, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 130, 134, 135, 136, 142, 143, 144, 145, 146, 147, 148, 154
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

As described in A051006, a monotonic sequence can be mapped into a fractional real. Then the binary digits of that real can be treated (transformed) by an elementary cellular automaton. Taken resulted sequence of binary digits as a fractional real, it can be mapped back into a sequence, as in A092855.

Crossrefs

Programs

  • PARI
    {ca_tr(ca,v)= /* Calculates the Cellular Automaton transform of the vector v by the rule ca */
    local(cav=vector(8),a,r=[],i,j,k,l,po,p=vector(3));
    a=binary(min(255,ca));k=matsize(a)[2];forstep(i=k,1,- 1,cav[k-i+1]=a[i]);
    j=0;l=matsize(v)[2];k=v[l];po=1;
    for(i=1,k+2,j*=2;po=isin(i,v,l,po);j=(j+max(0,sign(po)))% 8;if(cav[j+1],r=concat(r,i)));
    return(r) /* See the function "isin" at A092875 */}

A093517 Transform of the prime sequence by the Rule225 cellular automaton.

Original entry on oeis.org

1, 4, 5, 7, 10, 13, 16, 19, 22, 26, 27, 28, 31, 34, 35, 36, 40, 43, 46, 50, 51, 52, 56, 57, 58, 61, 64, 65, 66, 70, 73, 76, 77, 78, 82, 86, 87, 88, 92, 93, 94, 95, 96, 100, 103, 106, 109, 112, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 130, 134, 135, 136, 139
Offset: 1

Views

Author

Ferenc Adorjan (fadorjan(AT)freemail.hu)

Keywords

Comments

As described in A051006, a monotonic sequence can be mapped into a fractional real. Then the binary digits of that real can be treated (transformed) by an elementary cellular automaton. Taken resulted sequence of binary digits as a fractional real, it can be mapped back into a sequence, as in A092855.

Crossrefs

Programs

  • PARI
    {ca_tr(ca,v)= /* Calculates the Cellular Automaton transform of the vector v by the rule ca */
    local(cav=vector(8),a,r=[],i,j,k,l,po,p=vector(3));
    a=binary(min(255,ca));k=matsize(a)[2];forstep(i=k,1,- 1,cav[k-i+1]=a[i]);
    j=0;l=matsize(v)[2];k=v[l];po=1;
    for(i=1,k+2,j*=2;po=isin(i,v,l,po);j=(j+max(0,sign(po)))% 8;if(cav[j+1],r=concat(r,i)));
    return(r) /* See the function "isin" at A092875 */}
Previous Showing 11-20 of 48 results. Next