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.

A096235 Number of n-bit base-2 deletable primes.

This page as a plain text file.
%I A096235 #28 Jun 02 2025 12:51:48
%S A096235 0,2,2,2,3,6,6,11,18,31,49,87,155,253,427,781,1473,2703,5094,9592,
%T A096235 18376,35100,67183,129119,249489,482224,930633,1803598,3502353,
%U A096235 6813094,13271996,25892906,50583039,98948426,193629933,379398057,744508765,1461801309
%N A096235 Number of n-bit base-2 deletable primes.
%C A096235 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 A096235 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 A096235 d base-2 d-digit deletable primes
%e A096235 2 2=10, 3=11
%e A096235 3 5=101, 7=111
%e A096235 4 11=1011, 13=1101
%e A096235 5 19=10011, 23=10111, 29=11101
%e A096235 6 37=100101, 43=101011, 47=101111, 53=110101, 59=111011, 61=111101
%e A096235 7 73=1001001, 79=1001111, 83=1010011, 101=1100101, 107=1101011, 109=1101101
%t A096235 a = {0, 2}; d = {2, 3};
%t A096235 For[n = 3, n <= 15, n++,
%t A096235 p = Select[Range[2^(n - 1), 2^n - 1], PrimeQ[#] &];
%t A096235 ct = 0;
%t A096235 For[i = 1, i <= Length[p], i++,
%t A096235   c = IntegerDigits[p[[i]], 2];
%t A096235   For[j = 1, j <= n, j++,
%t A096235    t = Delete[c, j];
%t A096235    If[t[[1]] == 0, Continue[]];
%t A096235    If[MemberQ[d, FromDigits[t, 2]], AppendTo[d, p[[i]]]; ct++;
%t A096235      Break[]]]];
%t A096235 AppendTo[a, ct]];
%t A096235 a (* _Robert Price_, Nov 11 2018 *)
%o A096235 (Python)
%o A096235 from sympy import isprime
%o A096235 def ok(n, prevset):
%o A096235     if not isprime(n): return False
%o A096235     b = bin(n)[2:]
%o A096235     bi = (b[:i]+b[i+1:] for i in range(len(b)))
%o A096235     return any(t[0] != '0' and int(t, 2) in prevset for t in bi)
%o A096235 def afind(terms):
%o A096235     s, snxt = {2, 3}, set()
%o A096235     print("0,", len(s), end=", ")
%o A096235     for n in range(3, terms+1):
%o A096235         for i in range(2**(n-1), 2**n):
%o A096235             if ok(i, s):
%o A096235                 snxt.add(i)
%o A096235         s, snxt = snxt, set()
%o A096235         print(len(s), end=", ")
%o A096235 afind(20) # _Michael S. Branicky_, Jan 14 2022
%Y A096235 Cf. A080608, A080603, A096236-A096246.
%K A096235 nonn,base,more
%O A096235 1,2
%A A096235 _Michael Kleber_, Feb 28 2003
%E A096235 a(19)-a(30) from _Ryan Propper_, Jul 18 2005
%E A096235 a(31)-a(33) from _Michael S. Branicky_, Jan 14 2022
%E A096235 a(34)-a(37) from _Michael S. Branicky_, May 30 2025
%E A096235 a(38) from _Michael S. Branicky_, Jun 02 2025