%I #31 Sep 08 2022 08:46:25
%S 1,1,3,0,5,3,7,0,3,5,11,0,13,7,3,0,17,3,19,0,0,11,23,0,5,13,3,0,29,3,
%T 31,0,0,17,7,9,37,19,3,0,41,0,43,0,3,23,47,0,7,5,3,0,53,3,11,0,0,29,
%U 59,0,61,31,9,0,0,0,67,0,0,7,71,0,73,37,3,0,0,3,79,0,3,41,83,0,5,43,3,0,89,3
%N a(n) is the least number k of the form (the number of nonnegative bases m < n such that m^k == m (mod n))/(the number of nonnegative bases m < n such that -m^k == m (mod n)) dividing n, or 0 if no such k exists.
%C Conjecture: For each natural number n, either there is a divisor k of the form (the number of nonnegative bases m < n such that m^k == m (mod n))/(the number of nonnegative bases m < n such that -m^k == m (mod n)) and it is unique, or it does not exist.
%C This has been checked up to at least 10^3.
%o (Magma) [1] cat [&*[d: d in Divisors(n)]/&*[k: k in [1..n] | not #[m: m in [0..n-1] | m^k mod n eq m]/#[m: m in [0..n-1] | -m^k mod n eq m] eq k and n mod k eq 0] - 1 + #[k: k in [1..n] | #[m: m in [0..n-1] | m^k mod n eq m]/#[m: m in [0..n-1] | -m^k mod n eq m] eq k and n mod k eq 0]: n in [2..90]];
%o (PARI) a(n) = {fordiv(n, d, if (d == sum(m=0, n-1, Mod(m,n)^d == m)/sum(m=0, n-1, Mod(-m,n)^d == m), return (d)););} \\ _Michel Marcus_, Aug 20 2020
%Y Supersequence of A065091 and A002997. Cf. A334006.
%K nonn
%O 1,3
%A _Juri-Stepan Gerasimov_, Jul 26 2020