%I #7 Dec 19 2021 13:46:07
%S 1,13,15,22,25,107,115,149,163,472,808,1347,1979,27594,77150
%N Numbers n such that the sum of the digits of sum_{k=1..n}(k^k) is divisible by n.
%e sum_{k=1..13}(k^k) = 312086923782437; the digits of 312086923782437 sum to 65, which is divisible by 13, so 13 is in the sequence.
%t s = 0; Do[s += n^n; k = Plus @@ IntegerDigits[s]; If[Mod[k, n] == 0, Print[n]], {n, 1, 10^5}]
%t Module[{nn=2000,pwr},pwr=Accumulate[Table[n^n,{n,nn}]];Select[Thread[ {Range[nn],pwr}],Divisible[Total[IntegerDigits[#[[2]]]],#[[1]]]&]][[All,1]] (* The program generates the first 13 terms of the sequence. To generate more, increase the nn constant, but the program may take a long time to run and the computer may run out of memory. *) (* _Harvey P. Dale_, Dec 19 2021 *)
%K nonn,base
%O 1,2
%A _Ryan Propper_, Aug 06 2005
%E More terms from _Ryan Propper_, Nov 13 2005
|