login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A096235 Number of n-bit base-2 deletable primes. 34

%I #20 Jan 15 2022 16:08:31

%S 0,2,2,2,3,6,6,11,18,31,49,87,155,253,427,781,1473,2703,5094,9592,

%T 18376,35100,67183,129119,249489,482224,930633,1803598,3502353,

%U 6813094,13271996,25892906,50583039

%N Number of n-bit base-2 deletable primes.

%C A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime. However, in base 2 we adopt the convention that 2 = 10 and 3 = 11 are deletable.

%C Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

%e d base-2 d-digit deletable primes

%e 2 2=10, 3=11

%e 3 5=101, 7=111

%e 4 11=1011, 13=1101

%e 5 19=10011, 23=10111, 29=11101

%e 6 37=100101, 43=101011, 47=101111, 53=110101, 59=111011, 61=111101

%e 7 73=1001001, 79=1001111, 83=1010011, 101=1100101, 107=1101011, 109=1101101

%t a = {0, 2}; d = {2, 3};

%t For[n = 3, n <= 15, n++,

%t p = Select[Range[2^(n - 1), 2^n - 1], PrimeQ[#] &];

%t ct = 0;

%t For[i = 1, i <= Length[p], i++,

%t c = IntegerDigits[p[[i]], 2];

%t For[j = 1, j <= n, j++,

%t t = Delete[c, j];

%t If[t[[1]] == 0, Continue[]];

%t If[MemberQ[d, FromDigits[t, 2]], AppendTo[d, p[[i]]]; ct++;

%t Break[]]]];

%t AppendTo[a, ct]];

%t a (* _Robert Price_, Nov 11 2018 *)

%o (Python)

%o from sympy import isprime

%o def ok(n, prevset):

%o if not isprime(n): return False

%o b = bin(n)[2:]

%o bi = (b[:i]+b[i+1:] for i in range(len(b)))

%o return any(t[0] != '0' and int(t, 2) in prevset for t in bi)

%o def afind(terms):

%o s, snxt = {2, 3}, set()

%o print("0,", len(s), end=", ")

%o for n in range(3, terms+1):

%o for i in range(2**(n-1), 2**n):

%o if ok(i, s):

%o snxt.add(i)

%o s, snxt = snxt, set()

%o print(len(s), end=", ")

%o afind(20) # _Michael S. Branicky_, Jan 14 2022

%Y Cf. A080608, A080603, A096236-A096246.

%K nonn,base,more

%O 1,2

%A _Michael Kleber_, Feb 28 2003

%E a(19)-a(30) from _Ryan Propper_, Jul 18 2005

%E a(31)-a(33) from _Michael S. Branicky_, Jan 14 2022

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 04:13 EDT 2024. Contains 371235 sequences. (Running on oeis4.)