OFFSET
1,1
COMMENTS
25: 5^2 = 25;
96: 6^9 = 10077696 that ends in 96;
296: 6^29 = 36845653286788892983296 that ends in 296;
3125: 125^3 = 1953125 that ends in 3125.
MAPLE
with(numtheory): P:= proc(q) local a, b, c, d, k, n;
for n from 10 to q do d:=ilog10(n); for k from 1 to d do a:=(n mod 10^k)^trunc(n/10^k); b:=ilog10(a)+1;
if a mod 10^(d+1)=n then print(n); break; fi; od; od; end: P(10^6);
MATHEMATICA
Select[Range@ 110000, AnyTrue[Function[n, FromDigits@ If[Length@ # < IntegerLength@ n, #, Take[#, -IntegerLength@ n]] &@ IntegerDigits[#2^#1] & @@@ Map[Function[k, Map[FromDigits, TakeDrop[#, k]]], Range[Length@ # - 1]] &@ IntegerDigits@ n]@ #, Function[m, m == #]] &] (* Michael De Vlieger, Jan 14 2016 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Jan 04 2016
STATUS
approved