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-2 of 2 results.

A296807 Take a prime, convert it to base 2. Consider it as a string of digits and delete its leftmost and rightmost digit. Leading zeros are kept. Repeat the process. a(n) is the least prime that, in the first n steps of this process, generates a string that is a prime read in base 2.

Original entry on oeis.org

2, 13, 43, 151, 2143, 2143, 12479, 57727, 246527, 4267455487, 276009615632383, 4469780781584383, 576406542684520447
Offset: 0

Views

Author

Paolo P. Lava, Paolo Iachia, Dec 21 2017

Keywords

Comments

a(n) >= 2*4^n + 3*2^n - 1 = A297928(n) >= 2*(4^n + 2^n) + 1 = A085601(n), n > 0. - Iain Fox, Dec 29 2017 (edited by Iain Fox, Jan 08 2018)
a(17) <= 2^163 + 361736822347711983585853439 (probably much smaller), building on a Cunningham chain of length 17 found by Jaroslaw Wroblewski. a(n) exists for n <= 17, and probably for all n. - Jens Kruse Andersen, Jan 21 2018

Examples

			a(1) = 13 because 13 in base 2 is 1101 and 10 is 2 and 13 is the least number with this property;
a(2) = 43 because 43 in base 2 is 101011 while 0101 is 5 and 10 is 2 and 43 is the least number with this property;
a(3) = 151 because 151 in base 2 is 10010111 while 001011 is 11, 0101 is 5 and 10 is 2 and 151 is the least number with this property.
		

Crossrefs

Programs

  • Maple
    with(numtheory): P:=proc(q) local a,b,c,i,j,k,n,ok,x; x:=5; for k from 1 to q do for n from x to q do a:=convert(ithprime(n),base,2); ok:=1; for i from 1 to k do b:=nops(a)-i; while a[b]=0 do b:=b-1; od;
    c:=0; for j from b by -1 to i+1 do c:=2*c+a[j]; od;if not isprime(c) then ok:=0; break; fi; od;if ok=1 then x:=n; print(ithprime(n)); break; fi; od; od; end: P(10^20);
  • Mathematica
    Table[SelectFirst[Prime@ Range[#, # + 10^5] &@ PrimePi[2 (4^n + 2^n) + 1], AllTrue[Map[FromDigits[#, 2] &, Rest@ NestWhileList[Most@ Rest@ # &, IntegerDigits[#, 2], Length@ # > 2 &]], PrimeQ] &], {n, 8}] (* Michael De Vlieger, Dec 29 2017 *)
  • PARI
    a(n) = if(!n, return(2)); forprime(p=2*4^n + 3*2^n - 1, , my(b=p); for(x=1, n, b = (b - (b>=4*2^(logint(p, 2) - 2*x))*4*2^(logint(p, 2) - 2*x) - 1)/2; if(!isprime(b) || (b==2 && x!=n), next(2))); return(p)) \\ Iain Fox, Dec 29 2017 (corrected by Iain Fox, Oct 26 2019)

Extensions

Definition corrected, a(10)-a(12) by Jens Kruse Andersen, Jan 21 2018

A297962 Take a prime, convert it to base 2. Remove its most significant digit and its least significant digit; repeat this process. a(n) is the least prime that, in the first n steps of this process, generates n primes.

Original entry on oeis.org

13, 59, 631, 7039, 64063, 761087, 3619327, 74347519, 1577707519, 22200700927, 1668463173631, 290703062134783, 3413184213843967, 121597545150218239
Offset: 1

Views

Author

Paolo Iachia, Paolo P. Lava, Jan 09 2018

Keywords

Comments

From Jon E. Schoenfield, Jan 11 2018: (Start)
a(15) <= 6937869050647642111;
a(16) <= 7088202090368908328959;
a(17) <= 348624306087955627410980863. (End)

Examples

			a(1) = 13, because 13 in base 2 is 1101, 10 is the prime 2; and 13 is the least prime with this property.
a(2) = 59, because 59 = 111011_2, 1101_2 is the prime 13, 10_2 is the prime 2; and 59 is the least prime with this property.
a(3) = 631, because 631 = 1001110111_2, 111011_2 is the prime 59, 1101_2 is the prime 13, 10_2 is the prime 2; and 631 is the least prime with this property.
		

Crossrefs

Programs

  • Java
    private static BigInteger SearchAn() { BigInteger BIW, BICore; int tN=10; int j3; static final BigInteger BILim = new BigInteger("1000000000"); static final BigInteger BI2 = new BigInteger("2");for (BIW=BI2; BIW.compareTo(BILim)<0; BIW=BIW.add(BI2)) { BICore = BIW;  for (j3=1;j3
    				
  • Maple
    with(numtheory): P:=proc(q) local a,i,k,n,ok,x; x:=1;
    for n from 1 to q do for k from x to q do
    a:=convert(ithprime(k),binary,decimal);
    ok:=1; for i from 1 to n do a:=trunc(a/10) mod 10^(ilog10(a)-1);
    if not isprime(convert(a,decimal,binary)) then ok:=0; break; fi; od;
    if ok=1 then x:=k; print(ithprime(k)); break; fi; od; od; end: P(10^10);
  • Mathematica
    With[{s = Map[LengthWhile[#, PrimeQ] &@ NestWhileList[((# - 2^Floor@ Log2@ #) - 1)/2 &, #, # > 2 &] &, Prime@ Range[2^18]]}, Map[Prime@ First@ FirstPosition[s, #] &, Range@ Max@ s]] (* Michael De Vlieger, Jan 10 2018 *)

Formula

Let C(p) be the result of removing the MSD and the LSD of a prime p. C(p) = (p - 2^floor(log_2(p)) - 1)/2.

Extensions

a(10)-a(14) from Jon E. Schoenfield, Jan 11 2018
Showing 1-2 of 2 results.