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!)
A323390 Total number of primes that are both left-truncatable and right-truncatable in base n. 2
0, 2, 3, 5, 9, 7, 22, 8, 15, 6, 35, 11, 37, 17, 22, 12, 69, 12, 68, 18, 44, 13, 145, 16, 47, 20, 77, 13, 291, 15, 89, 27, 74, 20, 241, 18, 106, 25, 134, 15, 450, 23, 144, 33, 131, 24, 491, 27, 235, 29, 187, 23, 575, 30, 218, 31, 183, 25, 1377, 26, 247, 37, 231 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,2
LINKS
Chris Caldwell, right-truncatable prime, The Prime Glossary.
Eric Weisstein's World of Mathematics, Truncatable Prime
EXAMPLE
For n = 2, there are no both-truncatable primes, therefore a(2) = 0.
For n = 3, there are 2 both-truncatable primes: 2, 23.
For n = 4, there are 3 both-truncatable primes: 2, 3, 11.
For n = 5, there are 5 both-truncatable primes: 2, 3, 13, 17, 67.
For n = 6, there are 9 both-truncatable primes: 2, 3, 5, 17, 23, 83, 191, 479, 839.
PROG
(PARI)
digitsToNum(d, base) = sum(k=1, #d, base^(k-1) * d[k]);
isLeftTruncatable(d, base) = my(ok=1); for(k=1, #d, if(!isprime(digitsToNum(d[1..k], base)), ok=0; break)); ok;
generateFromPrefix(p, base) = my(seq = [p]); for(n=1, base-1, my(t=concat(n, p)); if(isprime(digitsToNum(t, base)), seq=concat(seq, select(v -> isLeftTruncatable(v, base), generateFromPrefix(t, base))))); seq;
bothTruncatablePrimesInBase(base) = my(t=[]); my(P=primes(primepi(base-1))); for(k=1, #P, t=concat(t, generateFromPrefix([P[k]], base))); vector(#t, k, digitsToNum(t[k], base));
a(n) = #(bothTruncatablePrimesInBase(n));
CROSSREFS
Sequence in context: A069805 A123923 A045965 * A346096 A324886 A277332
KEYWORD
nonn,base
AUTHOR
Daniel Suteu, Jan 13 2019
STATUS
approved

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 April 23 10:29 EDT 2024. Contains 371905 sequences. (Running on oeis4.)