Number of terms in each period of S000987.
2, 2, 8, 4, 12, 14, 18, 28, 22, 24, 24, 28, 42, 40, 56, 52, 60, 48, 46, 72, 80, 72, 80, 80, 96, 104, 88, 88, 94, 128, 152, 132, 136, 126, 104, 152, 162, 180, 176, 150, 192, 160, 196, 218, 196, 238, 224, 248, 216, 192, 222, 240, 272, 258, 276, 254, 232, 264
3
Compare with S000984.
T. D. Noe, Plot of terms 3..502
T. D. Noe, Table of terms 3..502
(Mma) t9 = {}; Do[s = Select[Range[2, p^2 - p], Mod[PowerMod[#, #, p] + (-1)^# PowerMod[# - 1, # - 1, p], p] == 0 &]; If[p^2 - p + s[[1]] > s[[-1]], AppendTo[s, p^2 - p + s[[1]]]]; AppendTo[t9, Length[Differences[s]]], {p, Prime[Range[3, 52]]}]; t9
Cf. S000984.
nonn
T. D. Noe, Mar 21 2017