cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A069090 Primes none of whose proper initial segments are primes.

This page as a plain text file.
%I A069090 #35 Jul 03 2021 10:57:16
%S A069090 2,3,5,7,11,13,17,19,41,43,47,61,67,83,89,97,101,103,107,109,127,149,
%T A069090 151,157,163,167,181,401,409,421,443,449,457,461,463,467,487,491,499,
%U A069090 601,607,631,641,643,647,653,659,661,683,691,809,811,821,823,827,829
%N A069090 Primes none of whose proper initial segments are primes.
%H A069090 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 A069090 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 A069090 Barry Carter, <a href="https://github.com/barrycarter/bcapps/blob/master/QUORA/A069090.m">Mathematica program</a>
%H A069090 StackExchange, <a href="http://math.stackexchange.com/q/437759/103975">Number of digits until a prime is reached</a>
%e A069090 The proper initial segments of 499 are 4 and 49, none of which are primes. So 499 is a term of the sequence.
%p A069090 isA069090 := proc(n)
%p A069090     local dgs,l ;
%p A069090     if isprime(n) then
%p A069090         dgs := convert(n,base,10) ;
%p A069090         ndgs := nops(dgs) ;
%p A069090         for l from 1 to ndgs-1 do
%p A069090             add( op(ndgs+i-l+1,dgs)*10^i,i=0..l-1) ;
%p A069090             if isprime(%) then
%p A069090                 return false;
%p A069090             end if;
%p A069090         end do:
%p A069090         true ;
%p A069090     else
%p A069090         false ;
%p A069090     end if;
%p A069090 end proc:
%p A069090 for n from 2 to 830 do
%p A069090     if isA069090(n) then
%p A069090         printf("%d,",n);
%p A069090     end if;
%p A069090 end do: # _R. J. Mathar_, Dec 15 2016
%t A069090 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 A069090 (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 A069090 (Haskell)
%o A069090 import Data.List (inits)
%o A069090 a069090 n = a069090_list !! (n-1)
%o A069090 a069090_list = filter
%o A069090    (all (== 0) . map (a010051 . read) . init . tail . inits . show)
%o A069090    a000040_list
%o A069090 -- _Reinhard Zumkeller_, Mar 11 2014
%o A069090 (Python)
%o A069090 from sympy import primerange, isprime
%o A069090 def ok(p):
%o A069090     s = str(p)
%o A069090     if len(s) == 1: return True
%o A069090     return all(not isprime(int(s[:i])) for i in range(1, len(s)))
%o A069090 def aupto(lim):
%o A069090     alst = []
%o A069090     for p in primerange(1, lim+1):
%o A069090         if ok(p): alst.append(p)
%o A069090     return alst
%o A069090 print(aupto(829)) # _Michael S. Branicky_, Jul 03 2021
%Y A069090 Cf. A074721. [_Franklin T. Adams-Watters_, Jun 26 2009]
%Y A069090 Cf. A000040, A010051, A276707.
%K A069090 base,nonn
%O A069090 1,1
%A A069090 _Joseph L. Pe_, Apr 05 2002
%E A069090 More terms from _Franklin T. Adams-Watters_, Jun 26 2009