**T**his week, the puzzle from the weekend edition of ** Le Monde** was easy to state:

*in the sequence (8+17n), is there a 6th power? a 7th? an 8th? If so, give the first occurrence*. So I first wrote an R code for a function testing whether an integer is

*any*power:

ispower=function(x){ ispo=FALSE logx=log(x) i=trunc(logx/log(2)) while((i>1)&&(!ispo)){ j=t=trunc(exp(logx/i)) while (t<x) t=j*t ispo=(x==t) if (!ispo){ j=t=j+1 while (t<x) t=j*t ispo=(x==t)} i=i-1} list(is=ispo,pow=j)}

*(The function returns the highest possible power.)* Then I ran the thing over the first million of values of the sequence:

fib=8 for (j in 1:10^6){ fib=fib+17 tes=ispower(fib) if (tes$is) print(c(fib,tes$pow,log(fib)/log(tes$pow)))}

only to find that only the powers 2,3,6,10,11,19 were present among the first terms. Continue reading