The OEIS is supported by the many generous donors to the OEIS Foundation.

a(n) is the smallest odd number k > 1 for which the Jacobi symbol (n / k) >= 0.

0

`%I #19 Nov 07 2023 07:27:43
`

`%S 3,3,7,3,3,5,3,3,7,3,3,5,3,3,5,3,3,9,3,3,5,3,3,7,3,3,5,3,3,5,3,3,7,3,
`

`%T 3,5,3,3,9,3,3,5,3,3,5,3,3,9,3,3,5,3,3,7,3,3,5,3,3,5,3,3,9,3,3,5,3,3,
`

`%U 9,3,3,5,3,3,5,3,3,7,3,3,5,3,3,9,3,3,5,3,3,5,3,3,7,3,3,5,3,3,7,3,3,5,3,3,5
`

`%N a(n) is the smallest odd number k > 1 for which the Jacobi symbol (n / k) >= 0.
`

`%C This sequence is periodic with period P = 3*5*7 = 105.
`

`%C All terms are in {3, 5, 7, 9}.
`

`%F a(n + 105) = a(n).
`

`%t a[n_] := Module[{k = 3}, While[JacobiSymbol[n, k] < 0, k += 2]; k]; Array[a, 105, 0]
`

`%o (PARI) a(n) = my(k=3); while(kronecker(n,k)<0, k+=2); k; \\ _Michel Marcus_, Nov 02 2023
`

`%Y Cf. A366973.
`

`%K nonn,easy
`

`%O 0,1
`

`%A _Amiram Eldar_ and _Thomas Ordowski_, Nov 02 2023
`