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.

A096237 Number of n-digit base-4 deletable primes.

This page as a plain text file.
%I A096237 #19 Jan 17 2022 11:40:41
%S A096237 2,3,9,26,75,213,615,1853,5854,18664,61248,205300,698575,2409598,
%T A096237 8408050,29657194
%N A096237 Number of n-digit base-4 deletable primes.
%C A096237 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. "Digit" means digit in base b.
%C A096237 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.
%t A096237 b = 4; a = {2}; d = {2, 3};
%t A096237 For[n = 2, n <= 8, n++,
%t A096237   p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
%t A096237   ct = 0;
%t A096237   For[i = 1, i <= Length[p], i++,
%t A096237    c = IntegerDigits[p[[i]], b];
%t A096237    For[j = 1, j <= n, j++,
%t A096237     t = Delete[c, j];
%t A096237     If[t[[1]] == 0, Continue[]];
%t A096237     If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; ct++;
%t A096237      Break[]]]];
%t A096237   AppendTo[a, ct]];
%t A096237 a (* _Robert Price_, Nov 12 2018 *)
%o A096237 (Python)
%o A096237 from sympy import isprime
%o A096237 from sympy.ntheory.digits import digits
%o A096237 def ok(n, prevset, base=4):
%o A096237     if not isprime(n): return False
%o A096237     s = "".join(str(d) for d in digits(n, base)[1:])
%o A096237     si = (s[:i]+s[i+1:] for i in range(len(s)))
%o A096237     return any(t[0] != '0' and int(t, base) in prevset for t in si)
%o A096237 def afind(terms):
%o A096237     alst = [2]
%o A096237     s, snxt, base = {2, 3}, set(), 4
%o A096237     print(len(s), end=", ")
%o A096237     for n in range(2, terms+1):
%o A096237         for i in range(base**(n-1), base**n):
%o A096237             if ok(i, s):
%o A096237                 snxt.add(i)
%o A096237         s, snxt = snxt, set()
%o A096237         print(len(s), end=", ")
%o A096237 afind(10) # _Michael S. Branicky_, Jan 17 2022
%Y A096237 Cf. A080608, A080603, A096235-A096246.
%K A096237 nonn,base,more
%O A096237 1,1
%A A096237 _Michael Kleber_, Feb 28 2003
%E A096237 a(6)-a(15) from _Ryan Propper_, Jul 19 2005
%E A096237 a(16) from _Michael S. Branicky_, Jan 17 2022