login
A087781
Number of non-congruent solutions to x^2 - x - 1 == 0 mod n.
1
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0
OFFSET
1,11
COMMENTS
Sequence A089270 gives the positions of the nonzero terms. The term a(n) gives the number of primitive solutions (x,y) of the equation x^2 + xy - y^2 = n.
FORMULA
From Do Thanh Nhan, Apr 18 2026: (Start)
a(n) = a(p_1^k_1 * p_2^k_2 * ... * p_t^k_t) = a(p_1^k_1) * a(p_2^k_2) * ... * a(p_t^k_t), where p_i are distinct primes for 1 <= i <= t and a(p^k) = 2 if p == 1, 4 (mod 5); 0 if p == 2, 3 (mod 5) or p=5 and k>1; and 1 otherwise.
a(n) = A034444(n) if n is not divisible by 5 and a(n) is nonzero; a(n) = A034444(n)/2 if n is divisible by 5 and a(n) is nonzero. Short proof of this: By the formula below, if for integer n not divisible by 5 and nonzero a(n), all prime powers p^k of n must satisfy a(p^k) = 2 and as such a(n) = 2^A001221(n) = A034444(n). Furthermore, if for integer n divisible by 5 and a(n) =/= 0, this means that all prime powers except for 5 must satisfy a(p^k) = 2 and a(5) = 1. Thus, a(n) = 2^(A001221(n) - 1) = A034444(n)/2. (End)
PROG
(Python)
from sympy import factorint
def a(n):
fact = factorint(n)
prod = 1
for p, k in fact.items():
if p == 5 and k != 1: return 0
if p % 5 in [1, 4] and p != 5: prod *= 2
elif p == 5: continue
else: return 0
return prod # Do Thanh Nhan, Apr 18 2026
CROSSREFS
Cf. A086937.
Sequence in context: A185374 A332014 A331984 * A181009 A270599 A091398
KEYWORD
mult,nonn,easy
AUTHOR
Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 06 2003
EXTENSIONS
More terms from David Wasserman, Jun 17 2005
STATUS
approved