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!)
A074365 Smallest prime > the concatenation of the first n natural numbers. 2

%I #12 Feb 13 2021 14:10:23

%S 2,13,127,1237,12347,123457,1234577,12345701,123456791,12345678923,

%T 1234567891013,123456789101119,12345678910111223,1234567891011121343,

%U 123456789101112131449,12345678910111213141523,1234567891011121314151753,123456789101112131415161869

%N Smallest prime > the concatenation of the first n natural numbers.

%H Michael S. Branicky, <a href="/A074365/b074365.txt">Table of n, a(n) for n = 1..369</a> (all terms with <= 1000 digits).

%e The first prime > 123, the concatenation of the first three natural numbers, is 127. Hence a(3) = 127.

%p a:= n-> nextprime(parse(cat($1..n))):

%p seq(a(n), n=1..19); # _Alois P. Heinz_, Feb 13 2021

%t 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

%t Table[NextPrime[FromDigits[Flatten[IntegerDigits/@Range[n]]]],{n,20}] (* _Harvey P. Dale_, Jan 16 2018 *)

%o (Python)

%o from sympy import nextprime

%o def a(n):

%o return nextprime(int("".join(map(str, (i for i in range(1, n+1)))))-1)

%o print([a(n) for n in range(1, 19)]) # _Michael S. Branicky_, Feb 13 2021

%K base,nonn

%O 1,1

%A _Joseph L. Pe_, Sep 26 2002

%E More terms from _Lior Manor_ Oct 08 2002

%E a(18) and beyond from _Michael S. Branicky_, Feb 13 2021

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 18 08:27 EDT 2024. Contains 371769 sequences. (Running on oeis4.)