OFFSET
1,7
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = Sum_{i=1..floor((n-1)/2)} ( i*(n-i) mod n ) * c(i) * c(n-i), where c is the prime characteristic (A010051).
EXAMPLE
a(14) = (3*11 mod 14) = 5. We don't count (7*7 mod 14) since we have p < q.
MAPLE
f:= proc(n) local L;
if n::odd then if isprime(n-2) then n-4 else 0 fi
else
add((-x^2) mod n, x = select(t -> isprime(t) and isprime(n-t), [seq(i, i=3..(n-1)/2, 2)]))
fi
end proc:
map(f, [$1..100]); # Robert Israel, Nov 25 2020
MATHEMATICA
Table[Sum[(PrimePi[i] - PrimePi[i - 1]) (PrimePi[n - i] - PrimePi[n - i - 1]) Mod[i (n - i), n], {i, Floor[(n - 1)/2]}], {n, 80}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, Nov 07 2020
STATUS
approved