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!)
A195335 a(n) is the smallest Xmas tree prime with a(n-1) as a prefix (starting with 2). 2

%I #32 Dec 27 2020 01:57:59

%S 2,211,211151,2111511013,211151101310867,211151101310867100673,

%T 2111511013108671006731000357,211151101310867100673100035710000931,

%U 211151101310867100673100035710000931100000213,2111511013108671006731000357100009311000002131000000901,211151101310867100673100035710000931100000213100000090110000001797

%N a(n) is the smallest Xmas tree prime with a(n-1) as a prefix (starting with 2).

%C A Xmas tree prime is a prime which is a concatenation of a prime with a single digit, a prime with two digits, a prime with three digits, a prime with four digits etc. By definition, the number of digits is a triangular number (A000217). Leading zeros are not allowed for any of the primes.

%H Terry Trotter, <a href="https://web.archive.org/web/20160629211025/http://trottermath.net/numtrivia/potpourri.html">Xmas tree primes</a> [Warning: As of March 2018 this site appears to have been hacked. Proceed with great caution. The original content should be retrieved from the Wayback machine and added here. - _N. J. A. Sloane_, Mar 29 2018]

%p read("transforms") ;

%p A195335 := proc(n)

%p option remember;

%p local prev,nxt,a ;

%p if n =1 then

%p 2;

%p else

%p prev := procname(n-1) ;

%p for nxt from 10^(n-1) to 10^n-1 do

%p if isprime(nxt) then

%p a := digcat2(prev,nxt) ;

%p if isprime(a) then

%p return a ;

%p end if;

%p end if;

%p end do:

%p return -1 ;

%p end if;

%p end proc: # _R. J. Mathar_, Sep 20 2011

%o (Python)

%o from sympy import isprime, nextprime

%o def alst(nn):

%o alst, astr = [2], "2"

%o for n in range(2, nn+1):

%o p = nextprime(10**(n-1))

%o while not isprime(int(astr + str(p))): p = nextprime(p)

%o alst.append(int(astr + str(p))); astr += str(p)

%o return alst

%o print(alst(11)) # _Michael S. Branicky_, Dec 26 2020

%Y Cf. A000217.

%K nonn,base

%O 1,1

%A _Kausthub Gudipati_, Sep 16 2011

%E Name corrected by _Michael S. Branicky_, Dec 26 2020

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 April 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)