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.

A133757 Total number of restricted right truncatable primes in base n.

This page as a plain text file.
%I A133757 #15 Feb 16 2025 08:33:06
%S A133757 0,1,2,4,11,7,20,23,27,28,61,61,153,130,151,157,301,343,561,806,1046,
%T A133757 615,1227,2136,2472,2288,3685,2110,5241,4798,7017,10630,14175,14127,
%U A133757 21267,15034,24677,29289,46814,29291,63872,58451,82839,143678,196033,99103,218108
%N A133757 Total number of restricted right truncatable primes in base n.
%C A133757 Prime digits p in base n are counted if there is no prime with 2 digits which can have its rightmost digit removed to produce p.
%H A133757 I. O. Angell and H. J. Godwin, <a href="http://dx.doi.org/10.1090/S0025-5718-1977-0427213-2">On Truncatable Primes</a>, Math. Comput. 31, 265-267, 1977.
%H A133757 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TruncatablePrime.html">Truncatable Prime</a>.
%H A133757 <a href="/index/Tri#tprime">Index entries for sequences related to truncatable primes</a>
%o A133757 (Python)
%o A133757 from sympy import isprime, primerange
%o A133757 def fromdigits(digs, base):
%o A133757     return sum(d*base**i for i, d in enumerate(digs))
%o A133757 def a(n):
%o A133757     prime_lists, an = [(p, ) for p in primerange(1, n)], 0
%o A133757     digits = 1
%o A133757     while len(prime_lists) > 0:
%o A133757         new_prime_strs = set()
%o A133757         for p in prime_lists:
%o A133757             can_extend = False
%o A133757             for d in range(n):
%o A133757                 c = (d, ) + p
%o A133757                 if isprime(fromdigits(c, n)):
%o A133757                     can_extend = True
%o A133757                     new_prime_strs.add(c)
%o A133757             if not can_extend:
%o A133757                 an += 1
%o A133757         prime_lists = list(new_prime_strs)
%o A133757         digits += 1
%o A133757     return an
%o A133757 print([a(n) for n in range(2, 27)]) # _Michael S. Branicky_, Dec 11 2022
%Y A133757 Cf. A076586.
%K A133757 nonn
%O A133757 2,3
%A A133757 _Martin Renner_, Jan 04 2008
%E A133757 a(6) corrected and a(11) and beyond from _Michael S. Branicky_, Dec 11 2022