%I #9 Mar 21 2015 04:58:30
%S 1,4,25,64,121,125,196,216,289,343,400,2744,3375,4096,12167,13824,
%T 15625,32768
%N Numbers n such that n = sum_digits(a)^sum_digits(b) = a+b, with a and b positive integers.
%C Obviously n must be a perfect power. - _Robert G. Wilson v_
%e 121 = 119 + 2 -> Sum_digits(119)=11; Sum_digits(2)=2 -> 11^2 = 121.
%e 2744 = 2741 + 3 -> Sum_digits(2741)=14; Sum_digits(3)=3 -> 14^3 = 2744.
%e Also 2744 = 2732+12 = 2723+21 = 2714+30 = 2642+102 = 2633+111 = 2624+120 = 2543+201 = 2534+210 = 2444+300 = 2100+644 = 2010+734 = 2001+743 = 1742+1002 = 1733+1011 = 1724+1020 = 1643+1101 = 1634+1110 = 1544+1200.
%p P:=proc(n) local a,i,j,k,x,w; for i from 1 by 1 to n do if (i mod 1000)=0 then print("sono a:",i); fi; if (trunc(i/2))*2=i then a:=i/2+1; else a:=(i+1)/2; fi; for j from 1 to a do w:=0;k:=i-j+1; while k>0 do w:=w+k-(trunc(k/10)*10); k:=trunc(k/10); od; x:=0;k:=j-1; while k>0 do x:=x+k-(trunc(k/10)*10); k:=trunc(k/10); od; if ((w^x=i) or (x^w=i)) then print(i,i-j+1,j-1); fi od; od; end: P(10000);
%t fQ[n_] := Block[{k = 0}, While[j = n - k; k < n && Plus @@ IntegerDigits[j]^Plus @@ IntegerDigits[k] != n, k++ ]; k != n]; lst = {}; Do[ If[GCD @@ Last /@ FactorInteger@n > 1 && fQ@n, Print@n; AppendTo[lst, n]], {n, 1934880}]; lst (* _Robert G. Wilson v_ *)
%Y Cf. A131070, A001597.
%K nonn
%O 1,2
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Jun 13 2007, Jun 15 2007
%E a(15)-a(18) from _R. J. Mathar_ and _Robert G. Wilson v_, Jun 14 2007