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!)
A069090 Primes none of whose proper initial segments are primes. 6

%I #35 Jul 03 2021 10:57:16

%S 2,3,5,7,11,13,17,19,41,43,47,61,67,83,89,97,101,103,107,109,127,149,

%T 151,157,163,167,181,401,409,421,443,449,457,461,463,467,487,491,499,

%U 601,607,631,641,643,647,653,659,661,683,691,809,811,821,823,827,829

%N Primes none of whose proper initial segments are primes.

%H Franklin T. Adams-Watters and R. Zumkeller, <a href="/A069090/b069090.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Franklin T. Adams-Watters)

%H Barry Carter, <a href="https://github.com/barrycarter/bcapps/blob/master/QUORA/A069090.b.txt.bz2">Table of n, a(n) for n = 1..1411151</a> (bz2 compressed)

%H Barry Carter, <a href="https://github.com/barrycarter/bcapps/blob/master/QUORA/A069090.m">Mathematica program</a>

%H StackExchange, <a href="http://math.stackexchange.com/q/437759/103975">Number of digits until a prime is reached</a>

%e The proper initial segments of 499 are 4 and 49, none of which are primes. So 499 is a term of the sequence.

%p isA069090 := proc(n)

%p local dgs,l ;

%p if isprime(n) then

%p dgs := convert(n,base,10) ;

%p ndgs := nops(dgs) ;

%p for l from 1 to ndgs-1 do

%p add( op(ndgs+i-l+1,dgs)*10^i,i=0..l-1) ;

%p if isprime(%) then

%p return false;

%p end if;

%p end do:

%p true ;

%p else

%p false ;

%p end if;

%p end proc:

%p for n from 2 to 830 do

%p if isA069090(n) then

%p printf("%d,",n);

%p end if;

%p end do: # _R. J. Mathar_, Dec 15 2016

%t 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 *)

%o (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

%o (Haskell)

%o import Data.List (inits)

%o a069090 n = a069090_list !! (n-1)

%o a069090_list = filter

%o (all (== 0) . map (a010051 . read) . init . tail . inits . show)

%o a000040_list

%o -- _Reinhard Zumkeller_, Mar 11 2014

%o (Python)

%o from sympy import primerange, isprime

%o def ok(p):

%o s = str(p)

%o if len(s) == 1: return True

%o return all(not isprime(int(s[:i])) for i in range(1, len(s)))

%o def aupto(lim):

%o alst = []

%o for p in primerange(1, lim+1):

%o if ok(p): alst.append(p)

%o return alst

%o print(aupto(829)) # _Michael S. Branicky_, Jul 03 2021

%Y Cf. A074721. [_Franklin T. Adams-Watters_, Jun 26 2009]

%Y Cf. A000040, A010051, A276707.

%K base,nonn

%O 1,1

%A _Joseph L. Pe_, Apr 05 2002

%E More terms from _Franklin T. Adams-Watters_, Jun 26 2009

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 September 10 04:30 EDT 2024. Contains 375773 sequences. (Running on oeis4.)