A074365 Smallest prime > the concatenation of the first n natural numbers.
2, 13, 127, 1237, 12347, 123457, 1234577, 12345701, 123456791, 12345678923, 1234567891013, 123456789101119, 12345678910111223, 1234567891011121343, 123456789101112131449, 12345678910111213141523, 1234567891011121314151753, 123456789101112131415161869
Offset: 1
Examples
The first prime > 123, the concatenation of the first three natural numbers, is 127. Hence a(3) = 127.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..369 (all terms with <= 1000 digits).
Crossrefs
Cf. A007908.
Programs
-
Maple
a:= n-> nextprime(parse(cat($1..n))): seq(a(n), n=1..19); # Alois P. Heinz, Feb 13 2021
-
Mathematica
p[n_] := Module[{r, i}, r = 2; i = 1; While[r <= n, i = i + 1; r = Prime[i]]; r]; s = ""; a = {}; Do[s = s <> ToString[Prime[i]]; a = Append[a, p[ToExpression[s]]], {i, 1, 8}]; a Table[NextPrime[FromDigits[Flatten[IntegerDigits/@Range[n]]]],{n,20}] (* Harvey P. Dale, Jan 16 2018 *)
-
Python
from sympy import nextprime def a(n): return nextprime(int("".join(map(str, (i for i in range(1, n+1)))))-1) print([a(n) for n in range(1, 19)]) # Michael S. Branicky, Feb 13 2021
Formula
a(n) = nextprime(A007908(n)). - Sean A. Irvine, Jan 20 2025
Extensions
More terms from Lior Manor, Oct 08 2002
a(18) and beyond from Michael S. Branicky, Feb 13 2021