login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A215747
a(n) = (-2)^n mod n.
3
0, 0, 1, 0, 3, 4, 5, 0, 1, 4, 9, 4, 11, 4, 7, 0, 15, 10, 17, 16, 13, 4, 21, 16, 18, 4, 1, 16, 27, 4, 29, 0, 25, 4, 17, 28, 35, 4, 31, 16, 39, 22, 41, 16, 28, 4, 45, 16, 19, 24, 43, 16, 51, 28, 12, 32, 49, 4, 57, 16, 59, 4, 55, 0, 33, 64, 65, 16, 61, 44, 69, 64, 71, 4, 7
OFFSET
1,5
COMMENTS
n^(n+2) mod (n+2) is essentially the same.
Indices of 0's: 2^k - 1, k>=0.
Indices of 1's: A006521 except the first term.
Indices of 3's: A015940.
Indices of 5's: 7, 133, 1517, 11761, ...
a(A000040(n)) = A000040(n)-2 = A040976(n).
LINKS
EXAMPLE
a(5) = (-2)^5 mod 5 = -32 mod 5 = 3.
MAPLE
a:= n-> (-2)&^n mod n:
seq(a(n), n=1..100); # Alois P. Heinz, Apr 08 2015
PROG
(Python)
for n in range(1, 333):
print((-2)**n % n, end=', ')
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Alex Ratushnyak, Aug 23 2012
STATUS
approved