Let S(A) be {1,2,3,...,(A1)} and S'(A,B) be the set of elements X from S(A) that satisfy X^B mod A=1. Assuming that A is prime, find the sum of all the elements of S'(A,B) in terms of A and B.
(In reply to
Hint2 by Praneeth)
Let d=gcd(B, A1), and let z be a primitive dth root of unity mod A. Then the sum we are looking for is f(A,B) = sum(z^k, k=0...d1). Multiplying the sum by z only rearranges the terms mod A, so f(A,B)=0 mod A if z is not 1 mod A, which happens iff d>1. Otherwise, if d=1, then the sum is just 1.
Now, if d is even, then the solutions to X^d=1 come in pairs (X, AX), and so the sum is A*d/2.
If d is odd, it's more complicated. If d=3, then the sum is < 1 + 2(A1), and since it's a multiple of A, it must be A itself. That is, f(A,B)=A if gcd(B,A1)=3. But even for d=5, I don't know the closed form. The largest possible value is f(A,5)=3A, which happens only for A={101,421,641,...}. f(A,5)=A for A={31, 151, 311, 541, 691, 821, 911, ...}, and f(A,5)=2A for
A={11, 41, 61, 71, 131, 181, 191, 211, 241, 251, 271, 281, 331, 401, 431, 461, 491, 521, 571, 601, 631, 661, 701, 751, 761, 811, 881, 941, 971, 991,...}
but I don't see the pattern.

Posted by Eigenray
on 20070802 08:04:00 