OFFSET
1,3
COMMENTS
Discriminant 9.
Are the positive entries the same as A056991? - R. J. Mathar, Jun 10 2014
We have x^2+xy-2y^2 = (x+2y)(x-y) which can be written as z(3x-2z) by letting z=x-y. All (x,z) pairs in the square 0<=x,z<=8 have values z(3x-2z) == {0,1,4,7} (mod 9), which shows that all positive terms of this sequence have digital roots that define A056991: this sequence is a subsequence of A056991 (with 0 as a special case). - R. J. Mathar, Jun 12 2014
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..22223
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
From Colin Barker, Oct 31 2016: (Start)
a(n) = a(n-1)+a(n-4)-a(n-5) for n>5.
G.f.: x^2*(1+2*x)*(1+x+x^2) / ((1-x)^2*(1+x)*(1+x^2)). (End)
E.g.f.: (8 + 3*cos(x) + (9*x - 11)*cosh(x) + sin(x) + (9*x - 10)*sinh(x))/4. - Stefano Spezia, Aug 05 2024
MAPLE
# Maple Program fb, for indefinite binary quadratic forms
# f = ax^2+bxy+cy^2 with discriminant d = b^2-4ac = s^2 a perfect square.
# Looks for numbers 0 <= n <= M represented and also primes represented.
fb:=proc(a, b, c, M) local s, t1, t2, n, d, dp;
if not issqr(b^2-4*a*c) then error "disct not a square"; return; fi;
s:=sqrt(b^2-4*a*c); t1:={0}; t2:={};
for n from 1 to M do
for d in numtheory[divisors](4*a*n) do dp:=4*a*n/d;
if ((d-dp) mod 2*s) = 0 and (((b+s)*dp-(b-s)*d) mod 4*a*s) = 0
then t1:={op(t1), n}; if isprime(n) then t2:={op(t2), n}; fi; break; fi;
od:
od:
[sort(convert(t1, list)), sort(convert(t2, list))];
end;
fb(1, 1, -2, 500);
MATHEMATICA
Select[Range[0, 1000], MatchQ[Mod[#, 9], Alternatives[0, 1, 4, 7]]&] (* Jean-François Alcover, Oct 31 2016 *)
PROG
(PARI) concat(0, Vec(x^2*(1+2*x)*(1+x+x^2)/((1-x)^2*(1+x)*(1+x^2)) + O(x^100))) \\ Colin Barker, Oct 31 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, May 31 2014, Jun 03 2014
STATUS
approved