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.

A096241 Number of n-digit base-8 deletable primes.

This page as a plain text file.
%I A096241 #19 Jan 16 2022 13:03:34
%S A096241 4,14,50,238,1123,5792,30598,166056,927639,5308458,30984757
%N A096241 Number of n-digit base-8 deletable primes.
%C A096241 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 A096241 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 A096241 b = 8; a = {4}; d = {2, 3, 5, 7};
%t A096241 For[n = 2, n <= 5, n++,
%t A096241   p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
%t A096241   ct = 0;
%t A096241   For[i = 1, i <= Length[p], i++,
%t A096241    c = IntegerDigits[p[[i]], b];
%t A096241    For[j = 1, j <= n, j++,
%t A096241     t = Delete[c, j];
%t A096241     If[t[[1]] == 0, Continue[]];
%t A096241     If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; ct++;
%t A096241      Break[]]]];
%t A096241   AppendTo[a, ct]];
%t A096241 a (* _Robert Price_, Nov 13 2018 *)
%o A096241 (Python)
%o A096241 from sympy import isprime
%o A096241 def ok(n, prevset, base=8):
%o A096241     if not isprime(n): return False
%o A096241     s = oct(n)[2:]
%o A096241     si = (s[:i]+s[i+1:] for i in range(len(s)))
%o A096241     return any(t[0] != '0' and int(t, base) in prevset for t in si)
%o A096241 def afind(terms):
%o A096241     s, snxt = {2, 3, 5, 7}, set()
%o A096241     print(len(s), end=", ")
%o A096241     for n in range(2, terms+1):
%o A096241         for i in range(8**(n-1), 8**n):
%o A096241             if ok(i, s):
%o A096241                 snxt.add(i)
%o A096241         s, snxt = snxt, set()
%o A096241         print(len(s), end=", ")
%o A096241 afind(7) # _Michael S. Branicky_, Jan 14 2022
%Y A096241 Cf. A080608, A080603, A096235-A096246, A322443.
%K A096241 nonn,base,more
%O A096241 1,1
%A A096241 _Michael Kleber_, Feb 28 2003
%E A096241 a(6)-a(10) from _Ryan Propper_, Jul 19 2005
%E A096241 a(11) from _D. S. McNeil_, Dec 08 2009