login
A074365
Smallest prime > the concatenation of the first n natural numbers.
2
2, 13, 127, 1237, 12347, 123457, 1234577, 12345701, 123456791, 12345678923, 1234567891013, 123456789101119, 12345678910111223, 1234567891011121343, 123456789101112131449, 12345678910111213141523, 1234567891011121314151753, 123456789101112131415161869
OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..369 (all terms with <= 1000 digits).
FORMULA
a(n) = nextprime(A007908(n)). - Sean A. Irvine, Jan 20 2025
EXAMPLE
The first prime > 123, the concatenation of the first three natural numbers, is 127. Hence a(3) = 127.
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 *)
PROG
(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
CROSSREFS
Cf. A007908.
Sequence in context: A372103 A394722 A073559 * A071362 A108471 A036078
KEYWORD
base,nonn
AUTHOR
Joseph L. Pe, Sep 26 2002
EXTENSIONS
More terms from Lior Manor, Oct 08 2002
a(18) and beyond from Michael S. Branicky, Feb 13 2021
STATUS
approved