login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A133757 Total number of restricted right truncatable primes in base n. 0

%I #14 Dec 11 2022 23:04:49

%S 0,1,2,4,11,7,20,23,27,28,61,61,153,130,151,157,301,343,561,806,1046,

%T 615,1227,2136,2472,2288,3685,2110,5241,4798,7017,10630,14175,14127,

%U 21267,15034,24677,29289,46814,29291,63872,58451,82839,143678,196033,99103,218108

%N Total number of restricted right truncatable primes in base n.

%C 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 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 Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/TruncatablePrime.html">Truncatable Prime</a>.

%H <a href="/index/Tri#tprime">Index entries for sequences related to truncatable primes</a>

%o (Python)

%o from sympy import isprime, primerange

%o def fromdigits(digs, base):

%o return sum(d*base**i for i, d in enumerate(digs))

%o def a(n):

%o prime_lists, an = [(p, ) for p in primerange(1, n)], 0

%o digits = 1

%o while len(prime_lists) > 0:

%o new_prime_strs = set()

%o for p in prime_lists:

%o can_extend = False

%o for d in range(n):

%o c = (d, ) + p

%o if isprime(fromdigits(c, n)):

%o can_extend = True

%o new_prime_strs.add(c)

%o if not can_extend:

%o an += 1

%o prime_lists = list(new_prime_strs)

%o digits += 1

%o return an

%o print([a(n) for n in range(2, 27)]) # _Michael S. Branicky_, Dec 11 2022

%Y Cf. A076586.

%K nonn

%O 2,3

%A _Martin Renner_, Jan 04 2008

%E a(6) corrected and a(11) and beyond from _Michael S. Branicky_, Dec 11 2022

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 28 01:15 EDT 2024. Contains 375477 sequences. (Running on oeis4.)