A135605 Consider the infinite string S = 12345678910111213141516171819202122232425262728293031... Sequence gives the first prime that starts at the k-th digit, skipping zero digits.
1234567891, 2, 3, 4567, 5, 67, 7, 89, 9101112131, 101, 11, 11, 1213, 2, 13, 3, 14151617, 41, 151, 5, 16171819202122232425262728293031323334353637383940414243, 61, 17, 7, 181, 81920212223242526272829303, 19, 920212223242526272829303132333435363738394041424344454647484950515253
Offset: 1
Examples
Examples from _N. J. A. Sloane_, Feb 24 2021: (Start) S = 1234567891011121314151617181920212... The 10th digit is a 1, and the first prime in S that starts with that digit is 101. The 11th digit is 0, so we skip it. The 12th digit is 1, and the first prime in S that starts with that digit is 11. The 13th digit is another 1, and the first prime in S that starts with that digit is another 11. The 14th digit is another 1, and the first prime in S that starts with that digit is 1213. And so on. (End)
Links
- Robert G. Wilson v, Table of n, a(n) for n=1..66
Programs
-
Mathematica
a[n_] := Block[{m = 0, d = n, i = 1, l, p}, While[m <= d, l = m; m = 9 i*10^(i - 1) + l; i++ ]; i--; p = Mod[d - l, i]; q = Floor[(d - l)/i] + 10^(i - 1); If[p != 0, IntegerDigits[q][[p]], Mod[q - 1, 10]]]; pp[j_, k_] := FromDigits[ Table[ a@i, {i, j, k}]]; f[n_] := Block[{m = n, p}, If[a@n != 0, (While[p = pp[n, m]; ! PrimeQ@ p, m++ ]; p),]]; Array[f, 29] (* Robert G. Wilson v, Mar 01 2008 *)
Extensions
More terms from Robert G. Wilson v, Mar 01 2008
Comments