OFFSET
1,4
COMMENTS
For primes p > 2, (x+1)^p - x^p == 1 (mod p^2) has trivial solutions x == 0, -1 (mod p) so they are excluded.
Equivalently, a(n) is the number of solutions to x^(p-1) == (x+1)^(p-1) == 1 (mod p^2) in the range 1 <= x <= p^2 - 2, p = prime(n), that is, number of x such that both x and x + 1 occurs in the n-th row of A143548.
All terms shown here are even. The first odd terms are a(183) = 17 and a(490) = 5, with corresponding primes prime(183) = 1093 and prime(490) = 3511. a(n) is odd iff prime(n) is in A001220.
Let g be a primitive root modulo p^2, then (x+1)^p - x^p == 1 (mod p^2) has nontrivial solutions x == g^((p-1)/3) or g^(2*(p-1)/3) (mod p), and x^(p-1) == (x+1)^(p-1) == 1 (mod p^2) has nontrivial solutions x == g^(p*(p-1)/3) or g^(2*p*(p-1)/3) (mod p^2). As a result, if prime(n) == 1 (mod 6) then a(n) > 0. Primes p == 5 (mod 6) such that the equations have nontrivial solutions are listed in A068209.
a(17) = 12 is surprisingly large comparing with its nearby terms. Among the first 1000 terms there are only 7 that are larger than 12. They are a(183) = 17 and a(385) = a(552) = a(582) = a(593) = a(739) = a(922) = 14 (the corresponding primes are 1093, 2659, 4003, 4243, 4339, 5623 and 7213).
LINKS
Robert Israel, Table of n, a(n) for n = 1..2500
EXAMPLE
The nontrivial solutions to (x+1)^7 - x^7 == 1 (mod 49) are x == 2, 4 (mod 7); the solutions to x^6 == (x+1)^6 == 1 (mod 49) are x == 18, 30 (mod 49), so a(4) = 2.
MAPLE
f:= proc(n) local p; p:= ithprime(n);
nops(select(t -> (t+1)^p - t^p mod p^2 = 1, [$1 .. p - 2]))
end proc:
map(f, [$1..100]); # Robert Israel, Mar 18 2024
PROG
(PARI) a(n) = my(p=prime(n)); sum(x=1, p-2, Mod(x+1, p^2)^p-Mod(x, p^2)^p==1);
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song, Oct 15 2018
EXTENSIONS
Name corrected by Robert Israel, Mar 18 2024
STATUS
approved