login
The number of n-digit numbers whose first k digits are divisible by k^2 for k = 1..n.
0

%I #20 Jan 14 2021 21:16:54

%S 9,22,24,16,7,7,1

%N The number of n-digit numbers whose first k digits are divisible by k^2 for k = 1..n.

%C There are total 86 numbers and 6480005 is the only 7-digit number to satisfy the requirement.

%e There are nine one-digit numbers divisible by 1 so a(1)=9.

%e For two-digit numbers, the second digit must make it divisible by 2^2, which gives 22 numbers: 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96 to satisfy the requirement. So a(2)=22.

%t a = Table[j, {j, 9}]; r = 2; t = {}; While[! a == {}, n = Length[a]; k = 1; b = {}; While[! k > n, z0 = a[[k]]; Do[z = 10*z0 + j; If[Mod[z, r*r] == 0, b = Append[b, z]], {j, 0, 9}]; k++]; AppendTo[t, n]; a = b; r++]; t

%Y Cf. A079042.

%K nonn,base,fini,full

%O 1,1

%A _Shyam Sunder Gupta_, Aug 08 2013