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.

User: Gregory Allen

Gregory Allen's wiki page.

Gregory Allen has authored 5 sequences.

A359664 Prime Maze Room 11, opposite parity of A059459 starting from prime room 11.

Original entry on oeis.org

11, 43, 41, 2089, 2081, 2083, 2087, 10889035741470030830827987437816582768679, 10889035741470030830827987437816582768647
Offset: 1

Author

Gregory Allen, Jan 10 2023

Keywords

Comments

This is the opposite parity sequence of A059459 and lexicographically least of this sequence.
It is currently not known whether both of these sequences are infinite.
I was able to calculate 40 terms; a(40) is a 3261-digit prime.
a(1) = 11; a(n+1) is obtained by writing a(n) in binary and trying to complement just one bit, starting with the least significant bit, until a new prime is reached. (Terms 2 and 3 are excluded values from the main sequence.)
Conjecture: Room 2 and Room 11 are unlinked, i.e., two separate mazes or branches/trees, as they are of opposite parities.

Crossrefs

Cf. A059459.

Programs

  • Mathematica
    maxBits = 2^14;
    ClearAll[a];
    a[1] = 3;
    a[2] = 2;
    a[3] = 11;
    n = 4;
    a[n_] :=
     a[n] = If[PrimeQ[a[n - 1]],
       bits = PadLeft[IntegerDigits[a[n - 1], 2], maxBits];
       For[i = 1, i <= maxBits, i++, bits2 = bits;
        bits2[[-i]] = 1 - bits[[-i]];
        If[i == maxBits, Print["maxBits reached"]; Break[],
         If[PrimeQ[an = FromDigits[bits2, 2]] &&
           FreeQ[Table[a[k], {k, 1, n - 1}], an], Return[an]]]],
       0]; Table[a[n], {n, 42}]

A341442 a(n) is the position of the start of the first occurrence of prime(n) after the decimal point in the expansion of e.

Original entry on oeis.org

4, 17, 11, 1, 200, 27, 88, 108, 16, 131, 189, 270, 124, 134, 25, 18, 11, 242, 59, 1, 157, 168, 205, 221, 35, 195, 941, 283, 1748, 355, 370, 4604, 1574, 1998, 223, 413, 201, 483, 232, 599, 2875, 120, 1382, 108, 607, 1067, 426, 2494, 1329, 517, 178, 574, 2133
Offset: 1

Author

Gregory Allen, Feb 11 2021

Keywords

Examples

			The first position at which prime(1)=2 occurs to the right of the decimal point in e=2.71828... is the 4th digit after the decimal point, so a(1)=4.
		

Crossrefs

Programs

  • Mathematica
    en=Characters[ToString@N[E,10000]];
    For[x=1,x<=100,x++,Print["x=",x," ",prn=Prime[x]," ",pos=First[SequencePosition[en,Characters[ToString[prn]]]-2]]]

Formula

a(n) = A078197(prime(n)). - Rémy Sigrist, Feb 12 2021

A128050 Position of start of first occurrence of prime(n) after the decimal point in expansion of golden ratio phi.

Original entry on oeis.org

19, 5, 22, 10, 34, 55, 35, 188, 131, 174, 137, 98, 90, 27, 102, 111, 166, 1, 150, 217, 479, 44, 25, 13, 81, 458, 1242, 744, 563, 96, 1602, 186, 97, 995, 259, 939, 1999, 1204, 641, 1191, 43, 833, 1682, 2833, 2708, 188, 647, 130, 62, 734, 2337, 1106, 307, 1156, 2532
Offset: 1

Author

Gregory Allen, Feb 13 2007

Keywords

Examples

			Golden ratio phi = 1.6180339887498948482045868343656381177... (see A001622).
First occurrence of prime(1) = 2 is at the 19th digit after the decimal point, hence a(1) = 19.
First occurrence of prime(5) = 11 starts at the 34th digit after the decimal point, hence a(5) = 34.
		

Crossrefs

Programs

  • Magma
    k:=3000; R := RealField(k); [ Position(IntegerToString(Round(10^k*(-1 + (Sqrt(elt)+1) / elt))), IntegerToString(NthPrime(n))) : n in [1..55] ]; /* Klaus Brockhaus, Feb 15 2007 */
  • Mathematica
    Module[{p = Rest[First[RealDigits[GoldenRatio, 10, 10^4]]], n = 0, a}, Reap[While[(a = SequencePosition[p, IntegerDigits[Prime[++n]], 1]) != {}, Sow[a[[1, 1]]]]][[2, 1]]] (* Paolo Xausa, Aug 01 2024 *)

Extensions

Edited, corrected and extended by Klaus Brockhaus, Feb 15 2007

A059458 A binary sequence: a(1) = 10 (2 in decimal) and a(n+1) is obtained by trying to complement just one bit of a(n), starting with the least significant bit, until a new prime is reached.

Original entry on oeis.org

10, 11, 111, 101, 1101, 11101, 11111, 10111, 10011, 10001, 10000000010001, 10000001010001, 10100001010001, 100001010001, 100001010011, 1010011, 1000011, 1000111, 1001111, 10001001111, 10000001111, 10000000111, 10000100111
Offset: 1

Author

Gregory Allen, Feb 02 2001

Keywords

Comments

This is the lexicographically least (in positions of the flipped bits) such sequence.
It is not known if the sequence is infinite.

Crossrefs

The decimal sequence is given in A059459. A base-ten analog is in A059471.

Programs

  • Maple
    See A059459 for Maple program.

Extensions

More terms from David W. Wilson, Feb 05 2001. For many further terms (but written in base 10) see A059459.

A059459 a(1) = 2; a(n+1) is obtained by writing a(n) in binary and trying to complement just one bit, starting with the least significant bit, until a new prime is reached.

Original entry on oeis.org

2, 3, 7, 5, 13, 29, 31, 23, 19, 17, 8209, 8273, 10321, 2129, 2131, 83, 67, 71, 79, 1103, 1039, 1031, 1063, 1061, 1069, 263213, 263209, 263201, 265249, 265313, 264289, 280673, 280681, 280697, 280699, 280703, 280639, 280607, 280603, 280859, 280843, 281867, 265483, 265547, 265579, 265571, 266083, 266081, 266089, 266093, 266029
Offset: 1

Author

Gregory Allen, Feb 02 2001

Keywords

Comments

This is the lexicographically least (in positions of the flipped bits) such sequence.
It is not known if the sequence is infinite.
"The prime maze - consider the prime numbers in base 2, starting with the smallest prime (10)2. One can move to another prime number by either changing only one digit of the number, or adding a 1 to the front of the number. Can we reach 11 = (1011)2.? 3331? The Mersennes?" (See 'Prime Links + +'.) If we start at 11 and exclude terms 2 and 3 we get terms 11, 43, 41, and so on. This is the opposite parity sequence.
a(130), if it exists, is greater than 2^130000. - Charles R Greathouse IV, Jan 02 2014
a(130) is equal to a(129) + 2^400092. - Giovanni Resta, Jul 19 2017

Crossrefs

Cf. A059458 (for this sequence written in binary), A059471. A strictly ascending analog: A059661, positions of the flipped bits: A059663.

Programs

  • Maple
    A059459search := proc(a,upto_bit,upto_length) local i,n,t; if(nops(a) >= upto_length) then RETURN(a); fi; t := a[nops(a)]; for i from 0 to upto_bit do n := XORnos(t,(2^i)); if(isprime(n) and (not member(n,a))) then print([op(a), n]); RETURN(A059459search([op(a), n],upto_bit,upto_length)); fi; od; RETURN([op(a),`and no more`]); end;
    E.g., call as: A059459search([2],128,200);
  • Mathematica
    maxBits = 2^11; ClearAll[a]; a[1] = 2; a[n_] := a[n] = If[ PrimeQ[ a[n-1] ], bits = PadLeft[ IntegerDigits[ a[n-1], 2], maxBits]; For[i = 1, i <= maxBits, i++, bits2 = bits; bits2[[-i]] = 1 - bits[[-i]]; If[ i == maxBits, Print[ "maxBits reached" ]; Break[], If[ PrimeQ[an = FromDigits[ bits2, 2]] && FreeQ[ Table[ a[k], {k, 1, n-1}], an], Return[an] ] ] ], 0]; Table[ a[n], {n, 129}] (* Jean-François Alcover, Jan 17 2012 *)
    f[lst_List] := Block[{db2 = IntegerDigits[lst[[-1]], 2]}, exp = Length@ db2; While[pp = db2; pp[[exp]] = If[OddQ@db2[[exp]], 0, 1]; pp = FromDigits[pp, 2]; !PrimeQ[pp] || MemberQ[lst, pp], exp--; If[exp == 0, exp++; PrependTo[db2, 0]]]; Append[lst, pp]]; Nest[f, {2}, 128] (* Robert G. Wilson v, Jul 17 2017 *)
  • PARI
    step(n)=my(k,t); while(vecsearch(v, t=bitxor(n,1<Charles R Greathouse IV, Jan 02 2014
    
  • Python
    from sympy import isprime
    from itertools import islice
    def agen():
        seen, cand = set(), 2
        while True:
            an = cand; bit = 1; seen.add(an); yield an
            while cand in seen or not isprime(cand):
                cand = an-bit if an&bit else an+bit
                bit <<= 1
    print(list(islice(agen(), 51))) # Michael S. Branicky, Oct 01 2022

Extensions

More terms and Maple program from Antti Karttunen, Feb 03 2001, who remarks that he was able to extend the sequence to the 104th term 151115727453207491916143 using the bit-flip-limit 128.