OFFSET
1,2
MATHEMATICA
Do[ If[ Mod[ PowerMod[ 7, n, n ] + PowerMod[ 6, n, n ] + PowerMod[ 5, n, n ] + PowerMod[ 4, n, n ] + PowerMod[ 3, n, n ] + PowerMod[ 2, n, n ] + 1, n ] == 0, Print[ n ] ], {n, 1, 10^6} ]
Select[Range[31500], Divisible[Plus@@(Range[7]^#), #]&] (* or *) Select[ Range[ 31500], Mod[Total[PowerMod[Range[7], #, #]], #]==0&] (* The second program is much faster than the first, and the second program is only a rewrite of the first program above *) (* Harvey P. Dale, Mar 12 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Aug 25 2000
STATUS
approved