OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
EXAMPLE
121 is OK because sum-of-digits=1+2+1=4 is perfect power.
MATHEMATICA
perfectPowerQ[n_] := n == 1 || GCD @@ FactorInteger[n][[All, 2]] > 1; Select[Range@ 10000, perfectPowerQ@ # && perfectPowerQ@ Total@ IntegerDigits@ # &] (* Michael De Vlieger, Oct 02 2015, after Ant King at A001597 *)
PROG
(PARI) isok(n) = (n==1 || ispower(n)) && (sumdigits(n)==1 || ispower(sumdigits(n))) \\ Dana Jacobsen, Oct 01 2015
(Perl) use ntheory ":all"; my @seq = grep { ($_==1 || is_power($_)) && (sumdigits($_) == 1 || is_power(sumdigits($_))) } 1..1000; say "@seq"; # Dana Jacobsen, Oct 01 2015
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Zak Seidov, Oct 10 2002
EXTENSIONS
More terms from Alois P. Heinz, Sep 06 2015
STATUS
approved