A171976 Numbers n such that the sum of the squares of the digits of n^n is a square.
0, 1, 2, 8, 10, 100, 123, 209, 312, 1000, 1668, 2191, 2268, 4767, 9338, 10000, 11004, 12248, 12322, 15926, 17951, 18202, 19764, 21807, 29509, 42647, 43072, 44750, 54237, 56634, 70383, 74032, 85325, 90906, 95261, 100000
Offset: 1
Examples
8 is in the sequence because 8^8 = 16777216 and 1^2+6^2+7^2+7^2+7^2+2^2+1^2+6^2 = 225 = 15^2.
Programs
-
Maple
with(numtheory): digits:=200:nn:=5000:for n from 0 to nn do:l:=length(n^n):n0:=n^n:s:=0:for m from 1 to l do:q:=n0:u:=irem(q,10):v:=iquo(q,10):n0:=v :s:=s+u^2:od:if sqrt(s)= floor(sqrt(s))then printf(`%d, `, n):else fi:od:
-
Mathematica
Join[{0},Select[Range[100000],IntegerQ[Sqrt[Total[IntegerDigits[ #^#]^2]]]&]] (* Harvey P. Dale, Sep 25 2018 *)
-
PARI
isok(n) = my(d = digits(n^n)); issquare (sum(i=1, #d, d[i]^2)); \\ Michel Marcus, Jan 15 2014
Extensions
Edited by D. S. McNeil, Nov 19 2010
Offset corrected and more terms added, Michel Marcus, Jan 15 2014