A072994 Number of solutions to x^n==1 (mod n), 1<=x<=n.
1, 1, 1, 2, 1, 2, 1, 4, 3, 2, 1, 4, 1, 2, 1, 8, 1, 6, 1, 8, 3, 2, 1, 8, 5, 2, 9, 4, 1, 4, 1, 16, 1, 2, 1, 12, 1, 2, 3, 16, 1, 12, 1, 4, 3, 2, 1, 16, 7, 10, 1, 8, 1, 18, 5, 8, 3, 2, 1, 16, 1, 2, 9, 32, 1, 4, 1, 8, 1, 4, 1, 24, 1, 2, 5, 4, 1, 12, 1, 32, 27, 2, 1, 24, 1, 2, 1, 8, 1, 12, 1, 4, 3
Offset: 1
Links
- T. D. Noe, Table of n, a(n) for n=1..10000
Programs
-
Maple
1, seq(nops(select(t -> t^n mod n = 1, [$1..n-1])),n=2..100); # Robert Israel, Dec 07 2014
-
Mathematica
f[n_] := (d = If[ OddQ@ n, 1, 2]; d*Length@ Select[ Range[ n/d], PowerMod[#, n, n] == 1 &]); f[1] = f[2] = 1; Array[f, 93] (* or *) f[n_] := Length@ Select[ Range@ n, PowerMod[#, n, n] == 1 &]; f[n_] := 1 /; n<2; Array[f, 93] (* Robert G. Wilson v, Dec 06 2014 *)
-
PARI
A072994=n->sum(k=1,n,Mod(k,n)^n==1) \\ M. F. Hasler, Feb 23 2014
Formula
Extensions
Corrected by T. D. Noe, May 19 2007
Comments