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.
%I A195302 #38 Jun 05 2025 13:46:25 %S A195302 2,3,5,7,211,223,229,241,271,283,311,313,317,331,337,347,353,359,367, %T A195302 373,379,383,389,397,523,541,547,571,719,743,761,773,797,211151, %U A195302 211193,211199,211229,211241,211271,211283,211313,211349,211373,211433,211457,211499,211571,211619,211643,211661,211691,211727,211811,211859,211877,211997,213131 %N A195302 Xmas tree primes. %C A195302 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 A195302 Alvin Hoover Belt, <a href="/A195302/b195302.txt">Table of n, a(n) for n = 1..100</a> %H A195302 Terry Trotter, <a href="http://trottermath.net/numtrivia/potpourri.html">POTPOURRI</a> %e A195302 359 is a Xmas tree prime because it is prime and 3 and 59 are prime. %e A195302 503 is not a Xmas tree prime although 5 and 3 are prime, because the leading 0 in front of the 3 is not allowed by definition. %p A195302 isA000217 := proc(n) %p A195302 for k from 0 do %p A195302 if n = k*(k+1)/2 then %p A195302 return k; %p A195302 elif n < k*(k+1)/2 then %p A195302 return -1 ; %p A195302 end if; %p A195302 end do; %p A195302 end proc: %p A195302 isA195302 := proc(n) %p A195302 local dgs,T,d,std,kList,k ; %p A195302 if isprime(n) then %p A195302 dgs := convert(n,base,10) ; %p A195302 T := isA000217(nops(dgs)) ; %p A195302 if T > 0 then %p A195302 std := 1 ; %p A195302 for d from T to 1 by -1 do %p A195302 kList := [op(std..std+d-1,dgs)] ; %p A195302 if op(-1,kList) = 0 then %p A195302 return false; %p A195302 end if; %p A195302 k := add(op(i,kList)*10^(i-1),i=1..nops(kList)) ; %p A195302 if not isprime(k) then %p A195302 return false; %p A195302 end if; %p A195302 std := std+d ; %p A195302 end do: %p A195302 return true; %p A195302 else %p A195302 false; %p A195302 end if; %p A195302 else %p A195302 false; %p A195302 end if; %p A195302 end proc: %p A195302 for i from 2 to 300000 do %p A195302 if isA195302(i) then %p A195302 printf("%d,",i) ; %p A195302 end if; %p A195302 end do: # _R. J. Mathar_, Sep 20 2011 %o A195302 (Python) %o A195302 from sympy import isprime, sieve %o A195302 from itertools import product %o A195302 def alst(n): %o A195302 alst, plen = [], 1 %o A195302 while True: %o A195302 sieve.extend(10**plen-1) %o A195302 primes = list(str(p) for p in sieve._list) %o A195302 primesbylen = [[p for p in primes if len(p)==i+1] for i in range(plen)] %o A195302 for t in product(*primesbylen): %o A195302 intt = int("".join(t)) %o A195302 if isprime(intt): alst.append(intt) %o A195302 if len(alst) == n: return alst %o A195302 plen += 1 %o A195302 print(alst(57)) # _Michael S. Branicky_, Dec 26 2020 %Y A195302 Cf. A195335. %K A195302 nonn,base %O A195302 1,1 %A A195302 _Kausthub Gudipati_, Sep 16 2011