[go: up one dir, main page]

login
A317623
Number of distinct values of X*(3*X-1) mod n.
2
1, 1, 3, 2, 3, 3, 4, 4, 9, 3, 6, 6, 7, 4, 9, 8, 9, 9, 10, 6, 12, 6, 12, 12, 11, 7, 27, 8, 15, 9, 16, 16, 18, 9, 12, 18, 19, 10, 21, 12, 21, 12, 22, 12, 27, 12, 24, 24, 22, 11, 27, 14, 27, 27, 18, 16, 30, 15, 30, 18, 31, 16, 36, 32, 21, 18, 34, 18, 36, 12, 36
OFFSET
1,3
LINKS
FORMULA
Multiplicative with a(2^e) = 2^(e-1), a(3^e) = 3^e, a(p^e) = 1 + floor( p^(e+1)/(2*p+2) ) for prime p >= 5.
MATHEMATICA
f[2, e_] := 2^(e-1); f[3, e_] := 3^e; f[p_, e_] := 1 + Floor[p^(e+1)/(2*p+2)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 13 2020 *)
PROG
(PARI) a(n)={my(v=vector(n)); for(i=0, n-1, v[i*(3*i-1)%n + 1]=1); vecsum(v)}
(PARI) a(n)={my(f=factor(n)); prod(i=1, #f~, my([p, e]=f[i, ]); if(p<=3, if(p==2, 2^(e-1), 3^e), 1 + p^(e+1)\(2*p+2)))}
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Andrew Howroyd, Aug 01 2018
STATUS
approved