OFFSET
1,1
LINKS
Jens Kruse Andersen, Table of n, a(n) for n = 1..10000
EXAMPLE
16 is the smallest perfect power > 9 beginning with 1. Thus a(1) = 6.
MAPLE
conc:= proc(n, k) if k = 0 then 10*n else 10^(1+ilog10(k))*n+k fi end proc:
ispow:= proc(x) local F; F:= ifactors(x)[2];
evalb(igcd(seq(f[2], f=F))>1) end proc:
a:= proc(n) local k; for k from 0 do if ispow(conc(n, k)) then return k fi od end proc;
seq(a(n), n=1..100); # Robert Israel, Jul 28 2014
PROG
(PARI)
a(n)=p=""; for(k=0, oo, p=concat(Str(n), Str(k)); if(ispower(eval(p)), return(k)))
n=1; while(n<100, print1(a(n), ", "); n++)
(Python)
from sympy import perfect_power
def a(n):
s, k = str(n), 0
while not perfect_power(int(s+str(k))): k += 1
return k
print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Jun 05 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jul 27 2014
STATUS
approved