A281684 Least composite k such that the concatenation of n consecutive composites, starting from k, is a prime.
8, 138, 87, 88, 14, 122, 121, 70, 21, 206, 405, 94, 15, 82, 195, 27, 729, 266, 358, 136, 318, 592, 18, 342, 202, 1182, 268, 155, 85, 292, 386, 888, 295, 551, 892, 118, 63, 95, 696, 1497, 315, 400, 954, 574, 33, 72, 85, 1377, 140, 1417, 158, 448, 994, 1370, 3399
Offset: 2
Examples
a(2) = 8 because the next composite after 8 is 9: concat(8, 9) = 89 is prime and 8 is the least number with this property; a(3) = 138 because the next composites after 138 are 140, 141: concat(138, 140, 141) = 138140141 is prime and 138 is the least number with this property.
Links
- Robert G. Wilson v, Table of n, a(n) for n = 1..1000 (terms 2..250 from Paolo P. Lava, terms 201..500 from Michel Marcus).
- Seqfan thread, Reversing A281684, March 2021.
Programs
-
Maple
with(numtheory): P:=proc(q) local a,b,i,j,k,n; for n from 2 to q do for k from 1 to q do if not isprime(k) then a:=k; b:=a; j:=1; while j
-
Mathematica
With[{c = Select[Range[10^5], CompositeQ]}, Table[k = 1; While[! PrimeQ@ FromDigits@ Flatten@ IntegerDigits@ Take[c, {k, k + n}], k++]; c[[k]], {n, 55}]] (* Michael De Vlieger, Jan 27 2017 *) NextComposite[n_Integer /; n > -1] := If[-1 < n < 3, 4, If[ PrimeQ[n + 1], n + 2, n + 1]]; a[n_] := Block[{k = 4}, While[ !PrimeQ[ FromDigits[ Flatten[ IntegerDigits[ NestList[ NextComposite, k, n - 1]]]]], k = NextComposite@ k]; k]; Array[a, 55, 2] (* Robert G. Wilson v, Mar 12 2021 *)
-
PARI
nextc(c, n) = {my(vc = vector(n), j = 2, x = c+1); vc[1] = c; while (j <= n, if (!isprime(x), vc[j] = x; j++); x++;); vc;} isok(vc) = {my(x=""); for (i=1, #vc, x = concat(x, Str(vc[i]))); ispseudoprime(eval(x));} a(n) = {forcomposite(c=4, oo, my(vc = nextc(c, n)); if (isok(vc), return(c)););} \\ Michel Marcus, Mar 03 2021
-
PARI
{inv_A281684(n,L=oo,k=1)=forcomposite(c=1+n=A002808(n),L,k++;ispseudoprime(n=n*10^(logint(c,10)+1)+c)&&return(k))} \\ "reversed function" (cf. comments): Find the least k such that the concatenation of k composites, starting with the n-th composite, yield a prime. 2nd optional arg allows to specify a search limit L, then an empty/zero result means that k > L. - M. F. Hasler, Aug 07 2021
Comments