OFFSET
1,2
COMMENTS
From Jianing Song, Nov 24 2018: (Start)
The sequence {Kronecker(k,n)} forms a Dirichlet character modulo n if and only if n !== 2 (mod 4).
LINKS
Jianing Song, Table of n, a(n) for n = 1..10000
Wikipedia, Kronecker symbol.
FORMULA
Multiplicative with a(p^e) = p, p > 2; a(2^e) = 2 for even e and 8 for odd e.
Sum_{k=1..n} a(k) ~ c * n^2, where c = (49/50) * Product_{p prime} (1 - 1/(p*(p+1))) = (49/50) * A065463 = 0.690353... . - Amiram Eldar, Dec 01 2022
EXAMPLE
The Kronecker symbol modulo 2 is 1, 0, -1, 0, -1, 0, 1, 0 with period 8, so a(2) = 8.
The Kronecker symbol modulo 9 is 1, 1, 0 with period 3, so a(9) = 3.
MATHEMATICA
Array[Apply[Times, FactorInteger[#] /. {p_, e_} /; p > 0 :> If[p == 2, 2 + 6 Boole[OddQ@ e], p]] &, 100] (* Michael De Vlieger, Nov 25 2018 *)
PROG
(PARI) a(n)={my(f=factor(n)); prod(i=1, #f~, if(f[i, 1]==2 && f[i, 2]%2, 8, f[i, 1]))} \\ Andrew Howroyd, Apr 29 2018
CROSSREFS
KEYWORD
nonn,easy,mult
AUTHOR
Jianing Song, Apr 02 2018
STATUS
approved