login
Nonnegative numbers of the form x^2+xy-2y^2.
6

%I #31 Aug 05 2024 20:07:30

%S 0,1,4,7,9,10,13,16,18,19,22,25,27,28,31,34,36,37,40,43,45,46,49,52,

%T 54,55,58,61,63,64,67,70,72,73,76,79,81,82,85,88,90,91,94,97,99,100,

%U 103,106,108,109,112,115,117,118,121,124,126,127,130,133,135,136,139,142,144,145,148,151,153,154,157,160,162,163,166,169,171,172,175,178,180,181

%N Nonnegative numbers of the form x^2+xy-2y^2.

%C Discriminant 9.

%C Are the positive entries the same as A056991? - _R. J. Mathar_, Jun 10 2014

%C 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

%H N. J. A. Sloane, <a href="/A242660/b242660.txt">Table of n, a(n) for n = 1..22223</a>

%H N. J. A. Sloane et al., <a href="https://oeis.org/wiki/Binary_Quadratic_Forms_and_OEIS">Binary Quadratic Forms and OEIS</a> (Index to related sequences, programs, references)

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).

%F From _Colin Barker_, Oct 31 2016: (Start)

%F a(n) = a(n-1)+a(n-4)-a(n-5) for n>5.

%F G.f.: x^2*(1+2*x)*(1+x+x^2) / ((1-x)^2*(1+x)*(1+x^2)). (End)

%F 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

%p # Maple Program fb, for indefinite binary quadratic forms

%p # f = ax^2+bxy+cy^2 with discriminant d = b^2-4ac = s^2 a perfect square.

%p # Looks for numbers 0 <= n <= M represented and also primes represented.

%p fb:=proc(a,b,c,M) local s,t1,t2,n,d,dp;

%p if not issqr(b^2-4*a*c) then error "disct not a square"; return; fi;

%p s:=sqrt(b^2-4*a*c); t1:={0}; t2:={};

%p for n from 1 to M do

%p for d in numtheory[divisors](4*a*n) do dp:=4*a*n/d;

%p if ((d-dp) mod 2*s) = 0 and (((b+s)*dp-(b-s)*d) mod 4*a*s) = 0

%p then t1:={op(t1),n}; if isprime(n) then t2:={op(t2),n}; fi; break; fi;

%p od:

%p od:

%p [sort(convert(t1,list)), sort(convert(t2,list))];

%p end;

%p fb(1,1,-2,500);

%t Select[Range[0, 1000], MatchQ[Mod[#, 9], Alternatives[0, 1, 4, 7]]&] (* _Jean-François Alcover_, Oct 31 2016 *)

%o (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

%Y Primes in this sequence = A002476.

%K nonn,easy

%O 1,3

%A _N. J. A. Sloane_, May 31 2014, Jun 03 2014