OFFSET
2,1
COMMENTS
For n = 2, 4, 5 and 8 there are the obvious solutions n^2 + 1, but these are not minimal for n = 3, 6, 7 and 9.
Which other n have least m less than n^2 + 1?
There will be a solution less than n^2 + 1 when n is divisible by 3 or by any prime == 1 (mod 3). - Franklin T. Adams-Watters, May 17 2011.
EXAMPLE
The obvious case for 4 is 4^2 +1 = 17 and 17^3=4913 == 1 (mod 16).
For 6 the least m^3 is not the obvious m=36^2+1=37 but m=13 to give 13^3=2197 == 1 (mod 49).
PROG
(PARI) a(n)=for(k=2, n^2+1, if(Mod(k, n^2)^3==1, return(k)))
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot, May 17 2011
EXTENSIONS
Corrected, extended, and edited by Franklin T. Adams-Watters, May 17 2011
STATUS
approved