OFFSET
1,1
LINKS
Franklin T. Adams-Watters and R. Zumkeller, Table of n, a(n) for n = 1..10000 (first 1000 terms from Franklin T. Adams-Watters)
Barry Carter, Table of n, a(n) for n = 1..1411151 (bz2 compressed)
Barry Carter, Mathematica program
StackExchange, Number of digits until a prime is reached
EXAMPLE
The proper initial segments of 499 are 4 and 49, none of which are primes. So 499 is a term of the sequence.
MAPLE
isA069090 := proc(n)
local dgs, l ;
if isprime(n) then
dgs := convert(n, base, 10) ;
ndgs := nops(dgs) ;
for l from 1 to ndgs-1 do
add( op(ndgs+i-l+1, dgs)*10^i, i=0..l-1) ;
if isprime(%) then
return false;
end if;
end do:
true ;
else
false ;
end if;
end proc:
for n from 2 to 830 do
if isA069090(n) then
printf("%d, ", n);
end if;
end do: # R. J. Mathar, Dec 15 2016
MATHEMATICA
Select[Prime[Range[200]], NoneTrue[FromDigits/@Table[Take[ IntegerDigits[ #], n], {n, IntegerLength[#]-1}], PrimeQ]&] (* The program uses the NoneTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jul 24 2016 *)
PROG
(PARI) ina(n)=if(!isprime(n), return(0)); while(n>9, n\=10; if(isprime(n), return(0))); 1 \\ Franklin T. Adams-Watters, Jun 26 2009
(Haskell)
import Data.List (inits)
a069090 n = a069090_list !! (n-1)
a069090_list = filter
(all (== 0) . map (a010051 . read) . init . tail . inits . show)
a000040_list
-- Reinhard Zumkeller, Mar 11 2014
(Python)
from sympy import primerange, isprime
def ok(p):
s = str(p)
if len(s) == 1: return True
return all(not isprime(int(s[:i])) for i in range(1, len(s)))
def aupto(lim):
alst = []
for p in primerange(1, lim+1):
if ok(p): alst.append(p)
return alst
print(aupto(829)) # Michael S. Branicky, Jul 03 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Joseph L. Pe, Apr 05 2002
EXTENSIONS
More terms from Franklin T. Adams-Watters, Jun 26 2009
STATUS
approved