A069090 Primes none of whose proper initial segments are primes.
2, 3, 5, 7, 11, 13, 17, 19, 41, 43, 47, 61, 67, 83, 89, 97, 101, 103, 107, 109, 127, 149, 151, 157, 163, 167, 181, 401, 409, 421, 443, 449, 457, 461, 463, 467, 487, 491, 499, 601, 607, 631, 641, 643, 647, 653, 659, 661, 683, 691, 809, 811, 821, 823, 827, 829
Offset: 1
Examples
The proper initial segments of 499 are 4 and 49, none of which are primes. So 499 is a term of the sequence.
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
Crossrefs
Cf. A074721. [Franklin T. Adams-Watters, Jun 26 2009]
Programs
-
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
-
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 *)
-
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
-
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
Extensions
More terms from Franklin T. Adams-Watters, Jun 26 2009