OFFSET
3,1
COMMENTS
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 3..10000
FORMULA
a[n_] := (For[k=2, Mod[n^k-1, k]>0, k++ ];k)
EXAMPLE
a(8)=7 because 7 divides 8^7-1 and there doesn't exist an m such that 1<m<7 and m divides 8^m-1.
MATHEMATICA
a[n_] := (For[k=2, Mod[n^k-1, k]>0, k++ ]; k); Table[a[n], {n, 3, 75}]
PROG
(PARI) a(n)=if(n%2, return(2)); my(m=3); while(Mod(n, m)^m!=1, m+=2); m \\ Charles R Greathouse IV, May 29 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Farideh Firoozbakht, Mar 26 2004
STATUS
approved