login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A236527
Primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime, starting with 3.
1
3, 31, 311, 3119, 31193, 3119317, 31193171, 311931713, 3119317139, 311931713939, 31193171393933, 3119317139393353, 31193171393933531, 3119317139393353121, 311931713939335312127, 311931713939335312127113, 31193171393933531212711399, 31193171393933531212711399123
OFFSET
1,1
COMMENTS
a(n + 1) is the next smallest prime beginning with a(n). Initial term is 3. These are the primes arising in A069605.
EXAMPLE
a(1) = 3 by definition.
a(2) is the next smallest prime beginning with 3, so a(2) = 31.
a(3) is the next smallest prime beginning with 31, so a(3) = 311.
MATHEMATICA
A069605[1] = 3; A236527[1] = 3; A069605[n_] := A069605[n] = Block[{k = 1, c = IntegerDigits @ Table[ a[i], {i, n - 1}]}, While[ !PrimeQ[ FromDigits[Flatten[Append[c, IntegerDigits[k]]]]], k += 2]; k]; A236527[n_] := A236527[n] = FromDigits[Flatten[IntegerDigits[A236527[n - 1]], IntegerDigits[A069605[n]]]]; Table[A236527[n], {n, 20}] (* Alonso del Arte, Jan 28 2014 based on Robert G. Wilson v's program for A069605 *)
nxt[n_]:=Module[{s=1}, While[CompositeQ[n*10^IntegerLength[s]+s], s+=2]; n*10^IntegerLength[s]+s]; NestList[nxt, 3, 20] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 22 2020 *)
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
..num = str(x)
..n = 1
..while n < 10**3:
....new_num = str(x) + str(n)
....if isprime(int(new_num)):
......print(int(new_num))
......x = new_num
......n = 1
....else:
......n += 1
b(3)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jan 27 2014
STATUS
approved