%I #15 Sep 13 2017 02:12:51
%S 1,63,72,135,81,27,36,1881,0,9,549,1683,1782,3465,1728,1287,1386,891,
%T 0,1188,95904,693,87912,204795,81918,42957,73926,792,0,40959,65934,
%U 36963,67932,1485,61938,297,53946,28971,0,30969,1881198,26973,47952,114885,4419558
%N a(n) is the smallest k > 0 such that the first n multiples of k have the same sum of digits, but (n+1)k has a different one. a(n)=0 if no such k exists.
%C a(10*t-1) = 0 for t > 0, because if the first 10*t-1 multiples of a number k have the same sum of digits, then 10*t*k also has the same sum, since sod(10*t*k) = sod(t*k).
%H Giovanni Resta, <a href="/A238088/b238088.txt">Table of n, a(n) for n = 1..1000</a>
%e a(4) = 135 since 1*135 = 135, 2*135 = 270, 3*135 = 405 and 4*135 = 540 all have the same sum of digits (9) while 5*135 = 675 has a different sum of digits.
%t sod[n_] := Plus @@ IntegerDigits@n; okQ[n_, k_] := Catch@Block[{s = sod@k}, Do[If[ sod[j*k] != s, Throw@ False], {j, 2, n}]; sod[k*(n + 1)] != s]; a[n_] := If[ Mod[n, 10] == 9, 0, Block[{k = 1}, While[! okQ[n, k], k++]; k]]; Array[a, 20]
%o (PARI) for(r=2, 46, n=0; if(Mod(r, 10)==0, print1(n, ", "), until(m==r, n++; s=sumdigits(n); m=1; until(!(sumdigits(n*m)==s), m++)); print1(n, ", "))); \\ _Arkadiusz Wesolowski_, Feb 21 2014
%Y Cf. A007953, A237994.
%K nonn,base
%O 1,2
%A _Giovanni Resta_, Feb 17 2014
|