A099552 a(n) is the smallest positive integer such that the concatenation of the first n terms is divisible by n.
1, 2, 3, 2, 5, 2, 5, 6, 1, 10, 2, 12, 5, 14, 5, 6, 8, 10, 15, 20, 7, 6, 18, 24, 25, 6, 32, 32, 3, 10, 1, 12, 41, 34, 5, 6, 8, 46, 33, 20, 34, 36, 21, 24, 30, 36, 36, 48, 23, 50, 56, 44, 34, 42, 30, 48, 9, 26, 4, 60, 44, 34, 33, 60, 65, 28, 16, 32, 66, 20, 29, 44, 78, 48, 75, 52, 9, 8, 37
Offset: 1
Links
- Paul Tek, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
spi[{ctn_,n_,a_}]:=Module[{k=1},While[Mod[ctn*10^IntegerLength[k]+k,n+1] != 0,k++];{ctn*10^IntegerLength[k]+k,n+1,k}]; NestList[spi,{1,1,1},80][[All,3]] (* Harvey P. Dale, Nov 30 2022 *)
-
PARI
num = 1; print(1); for (n = 2, 9, c = 10*num%n; d = n - c; print(d); num = 10*num + d); for (n = 10, 90, c = 10*num%n; d = n - c; if (d < 10, print(d); num = 10*num + d, c = 100*num%n; d = n - c; if (d < 10, d = d + n); print(d); num = 100*num + d));