OFFSET
1,5
LINKS
Jianing Song, Table of n, a(n) for n = 1..10000
FORMULA
Additive with a(2) = 0, a(4) = 1, a(8) = 2, a(2^e) = 3, e >= 4; a(p^e) = 2 for p == 1 (mod 4), 1 for p == 3 (mod 4).
EXAMPLE
a(16) = 3 since x^4 == 1 (mod 16) has 2^3 = 8 solutions.
MATHEMATICA
f[p_, e_] := If[Mod[p, 4] == 1, 2, 1]; f[2, e_] := Switch[e, 1, 0, 2, 1, 3, 2, _, 3]; a[1] = 0; a[n_] := Plus @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Oct 05 2023 *)
PROG
(PARI) a(n)=my(f=factor(n)); sum(i=1, #f~, if(f[i, 1]==2, min(f[i, 2]-1, 3), if(f[i, 1]%4==1, 2, 1))) \\ after Charles R Greathouse IV's program for A073103
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jianing Song, Oct 19 2022
STATUS
approved