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.

A096243 Number of n-digit base-10 deletable primes.

This page as a plain text file.
%I A096243 #16 Jul 06 2023 09:32:52
%S A096243 4,16,94,585,3788,25768,182762,1340905,10135727,78580647,622188500
%N A096243 Number of n-digit base-10 deletable primes.
%C A096243 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.
%C A096243 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 A096243 b = 10; a = {4}; d = {2, 3, 5, 7};
%t A096243 For[n = 2, n <= 5, n++,
%t A096243   p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
%t A096243   ct = 0;
%t A096243   For[i = 1, i <= Length[p], i++,
%t A096243    c = IntegerDigits[p[[i]], b];
%t A096243    For[j = 1, j <= n, j++,
%t A096243     t = Delete[c, j];
%t A096243     If[t[[1]] == 0, Continue[]];
%t A096243     If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; ct++;
%t A096243      Break[]]]];
%t A096243   AppendTo[a, ct]];
%t A096243 a (* _Robert Price_, Nov 13 2018 *)
%o A096243 (Python)
%o A096243 from sympy import isprime
%o A096243 def ok(n, prevset):
%o A096243     if not isprime(n): return False
%o A096243     s = str(n)
%o A096243     si = (s[:i]+s[i+1:] for i in range(len(s)))
%o A096243     return any(t[0] != '0' and int(t) in prevset for t in si)
%o A096243 def afind(terms):
%o A096243     s, snxt = {2, 3, 5, 7}, set()
%o A096243     print(len(s), end=", ")
%o A096243     for n in range(2, terms+1):
%o A096243         for i in range(10**(n-1), 10**n):
%o A096243             if ok(i, s):
%o A096243                 snxt.add(i)
%o A096243         s, snxt = snxt, set()
%o A096243         print(len(s), end=", ")
%o A096243 afind(6) # _Michael S. Branicky_, Jan 14 2022
%Y A096243 Cf. A080608, A080603, A096235-A096246.
%K A096243 nonn,more,base
%O A096243 1,1
%A A096243 _Michael Kleber_, Feb 28 2003
%E A096243 a(6)-a(9) from _Ryan Propper_, Jul 19 2005
%E A096243 a(10) from _Michael S. Branicky_, Jan 14 2022
%E A096243 a(11) from _Michael S. Branicky_, Jul 06 2023