OFFSET
1,1
COMMENTS
Second terms of triple Peano sequence A071988. [Robert G. Wilson v, Jul 03 2002]
Number of different squares modulo p^2, for p ranging over the primes. Proof: the p multiples of p (0, p, 2p...) have the same square: 0 mod p^2. The other elements have the same square iff they are opposite: x^2 == y^2 (mod p^2) iff (x - y)(x + y) == 0 (mod p^2) iff x == y (mod p) or x == -y (mod p) or 2y == 0 (mod p). So the (p^2 - p) non-p-multiples account for (p^2 - p)/2 different squares and the p-multiples for 1 extra square, giving a total of (p^2 - p + 2)/2. [Bert Seghers, Dec 21 2011]
From Jianing Song, Apr 13 2019: (Start)
For k coprime to prime(n), k^a(n) == +-k (mod prime(n)^2).
For every integer k, k^(2a(n)) == k^2 (mod prime(n)^2). (End)
FORMULA
a(n) = A008837(n) + 1.
MATHEMATICA
seq[n_Integer?Positive] := Module[{fn01 = 1, fn10 = 1, fnout = 1}, Do[{fn10, fn01, fnout} = {fn10 + 1, fn01 + fn10, fn01 + fnout}, {n - 1}]; {fn10, fn01, fnout}]; Ar = Flatten[ Table[ seq[ Prime[n]], {n, 1, 50}]]; a = {}; Do[a = Append[a, Ar[[n]]], {n, 2, 150, 3}]; a
PROG
(Sage) [(p^2 - p + 2)/2 for p in prime_range(200)]
(PARI) a(n)=binomial(prime(n), 2)+1 \\ Charles R Greathouse IV, Jan 11 2012
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Jul 03 2002
EXTENSIONS
Name edited by Bert Seghers, Jan 01 2012
STATUS
approved