OFFSET
1,1
COMMENTS
Leading zeros are not allowed (cf. A166504).
For any k > 0, there are A246806(k) terms with k digits. - Rémy Sigrist, Jan 08 2023
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Henri Picciotto, Selected Integer Sequences
EXAMPLE
101 is a member since it is prime; 303 is not since it is composite and 30 is also not a prime.
PROG
(PARI) is_A152242(n)=/* If n is even, the last digit must be 2 and [n\10] (if nonzero) must be in this sequence. (This check is not necessary but improves speed.) */ bittest(n, 0) || return( n%10==2 && (n<10 || is_A152242(n\10))); isprime(n) && return(1); for(i=1, #Str(n)-1, n%10^i>10^(i-1) && isprime( n%10^i ) && is_A152242( n\10^i) && return(1)) \\ M. F. Hasler, Oct 15 2009; edited Oct 16 2009, to disallow leading zeros
(Python)
def ok(n):
if isprime(n): return True
s = str(n)
return any(s[i]!="0" and isprime(int(s[:i])) and ok(int(s[i:])) for i in range(1, len(s)))
print([k for k in range(180) if ok(k)]) # Michael S. Branicky, Sep 01 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini, Oct 15 2009
EXTENSIONS
More terms from M. F. Hasler and Zak Seidov, Oct 15 2009
STATUS
approved