login
Least number k > 0 such that digsum(n^k) = n, or 0 if no such k exists.
5

%I #33 Jul 15 2018 13:00:09

%S 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,3,3,0,13,0,4,0,0,4,3,3,4,0,0,7,0,0,

%T 7,5,4,0,0,0,13,0,0,7,0,6,5,0,0,0,0,0,0,7,6,0,0,0,7,0,0,0,0,8,6,0,0,0,

%U 7,0,0,9,0,0,0,0,0,0,0,0,17,9,10,0,0,10,13,0,0,0,19,14,0,0,10,0,0,10,11,0,0

%N Least number k > 0 such that digsum(n^k) = n, or 0 if no such k exists.

%C a(10^n) = 0 for all n > 0.

%C a(n) = 0 if and only if n is in A124367, complement of A124359.

%C The PARI code uses that, if sumdigit(n^k) <> n until sumdigits(n^k) > 2n for the first time, then sumdigits(n^k) <> n for all larger k. This might not be true for all n, although statistically sumdigits(n^k) ~ 4.5*log_10(n')*k within a few % (n' = n with trailing 0's removed), when k is not too small. - _M. F. Hasler_, May 18 2017

%H Hans Havermann, <a href="/A247889/b247889.txt">Table of n, a(n) for n = 0..10000</a>

%o (PARI) A247889(n,L=2*n)= if(n<10||vecmin(digits(n-1))==9,return(n<10));k=1;while(L >= s=sumdigits(n^k),if(s,return(k));k++) \\ Renamed to A247889 for use in A124359, A124367 (and elsewhere?), and minor edits by _M. F. Hasler_, May 18 2017

%o apply(A247889,[0..100])

%Y Cf. A124359 (a(n) > 0), A124367 (a(n) = 0), A007953, A152147.

%K nonn,base

%O 0,18

%A _Derek Orr_, Sep 25 2014

%E Data corrected (initial 1 removed, terminal 0 added) by _Hans Havermann_, Jul 13 2018