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.

A382899 The smallest n-digit prime that turns composite at each step as its digits are successively appended, starting from the first.

This page as a plain text file.
%I A382899 #30 Apr 16 2025 09:02:08
%S A382899 2,11,101,1013,10007,100003,1000003,10000019,100000007,1000000007,
%T A382899 10000000019,100000000003,1000000000061,10000000000037,
%U A382899 100000000000031,1000000000000037,10000000000000061,100000000000000013,1000000000000000003,10000000000000000051
%N A382899 The smallest n-digit prime that turns composite at each step as its digits are successively appended, starting from the first.
%H A382899 Michael S. Branicky, <a href="/A382899/b382899.txt">Table of n, a(n) for n = 1..1000</a>
%e A382899 a(1) = 2, because 2 is prime, 22 = 2*11 is composite, while no smaller one-digit prime exhibits this property.
%e A382899 a(2) = 11, because 11 is prime, 111 = 3*37 and 1111 = 11*101 are composite, while no smaller two-digit prime exhibits this property.
%e A382899 a(4) = 1013, because 1013 is prime, 10131 = 3 * 11 * 30, 101310 = 2 * 3 * 5 * 11 * 307, 1013101 = 227 * 4463 and 10131013 = 73 * 137 * 1013 are composite, while no smaller 4-digit prime exhibits this property.
%o A382899 (PARI) isok(p, n) = my(d=digits(p)); for (i=1, #d, p = 10*p+d[i]; if (isprime(p), return(0));); return(1);
%o A382899 a(n) = my(p=nextprime(10^(n-1))); while (!isok(p, n), p = nextprime(p+1)); p; \\ _Michel Marcus_, Apr 09 2025
%o A382899 (Python)
%o A382899 from sympy import isprime, nextprime
%o A382899 def c(s): # check if prime p's string of digits meets the concatenation condition
%o A382899     return not any(isprime(int(s:=s+c)) for c in s)
%o A382899 def a(n):
%o A382899     p = nextprime(10**(n-1))
%o A382899     while not c(str(p)): p = nextprime(p)
%o A382899     return p
%o A382899 print([a(n) for n in range(1, 21)]) # _Michael S. Branicky_, Apr 09 2025
%Y A382899 Cf. A003617, A382981.
%K A382899 nonn,base
%O A382899 1,1
%A A382899 _Jean-Marc Rebert_, Apr 08 2025