A341717 a(n) = smallest m >= n such that the decimal concatenation n||n+1||n+2||...||m is prime, or -1 if no such prime exists.
2, 3, 7, 5, 7, 7, 9, 187
Offset: 2
Programs
-
Mathematica
Array[Block[{k = #, s = #}, While[! PrimeQ[s], k++; s = FromDigits[IntegerDigits[s]~Join~IntegerDigits[k]]]; k] &, 8, 2] (* Michael De Vlieger, Feb 22 2021 *)
-
PARI
A341717(n)=if(isprime(n), n, A084559(n)) \\ M. F. Hasler, Feb 22 2021
Formula
a(n) = n iff n is prime, otherwise a(n) = A084559(n). - M. F. Hasler, Feb 22 2021
Comments