# [seqfan] Re: A006451 = n such that n*(n+1)/2+1 is square?

Matthijs Coster info at matcos.nl
Sat Oct 10 22:10:23 CEST 2009

```Hallo Joerg,

> Quick & dirty:
> ? for(k=0,20,q=0;for(n=1,10000,t=n*(n+1)/2+k;if(issquare(t),q=1;break())); if(q, print1(k,", ")))

Notice:

n(n+1)/2 + k = t^2

multiply by 8 then we have

(2n+1)^2 + (8k-7) = 2(2t)^2.

Substitute X for 2t and Y for 2n+1. We get the Pell-equation:

(*) 2X^2 - Y^2 = 8k-7

(*) can be solved if and only if the squarefree part of 8k-7 doesn't
contain factors congruent to 3 or 5 modulo 8.
Therefore the quick and dirty program can be improved by:

for (k = 1; k < K_0; k++)
{
n = 8*k-1;
factor(n,factors);
for (i = 0; i < factors.length; i++)
if (((factors[i].a % 8 == 3) || (factors[i].a % 8 == 5)) &&
(factors[i].b % 2 == 1))
result[k] = "no solution";
else
result[k] = "solution";
fprintf("%d %s\n", k, result[k]);
}

Greetings,

Matthijs Coster

>
> I.e., there are no solutions for k == 1/8 (mod p), except k == 1/8 (mod
> p^2), where p is any prime == 3 or 5 mod 8.  But my conjecture is not
> quite correct; one must extend to higher powers of p; for such p, there
> are no solutions for k == 1/8 (mod p^3), unless k == 1/8 mod (p^4),
> etc.  (The first counter-example to the original conjecture is k = 422,
> where 8k-1 = 15^3.)
>
> This suggests the following algorithm: factor 8k-1.  Discard any square
> factors (cf. A007913).  If any prime == 3 or 5 (mod 8) remains, there
> are no solutions.  (This is certain.)  If no such prime factor remains,
> there are solutions.  (This is conjecture).
>
>
>
> -----Original Message-----
> From: franktaw at netscape.net
>
> There are no solutions for k == 2 (mod 3), except k == 8 (mod 9).
> There are no solutions for k == 2 (mod 5), except k == 22 (mod 25).
> There are no solutions for k == 7 (mod 11), except k == 106 (mod 121).
> There are no solutions for k == 5 (mod 13), except k == 148 (mod 169).
> There are no solutions for k == 12 (mod 19), except k == 316 (mod 361).
> There are no solutions for k == 11 (mod 29), except k == 736 (mod 841).
>
> This covers all k up to 100.
>
> The primes in this list, to this point, are
> http://research.att.com/~njas/sequences/A001122, primes with primitive
> root 2.  I think the correct sequence is primes for which 2 is a
> quadratic non-residue, which is to say primes congruent to 3 or 5 mod
> 8.  This makes sense; the factor of 2 in n(n+1)/2 takes the squares to
> non-squares (we can complete the square n(n+1) = (n+1/2)^2-1/4, which
> can evaluated mod p for odd p), excluding the multiples of p; there
> will be one solution mod p^2 so that multiples of p^2 appear in the
> list of sums.  The first prime with 2 as a non-residue but not a
> primitive root is 43, and I would expect there to be an expression of
> this form for 43.
>
> I'm too tired right now to try to determine what the critical residues
> are mod p and p^2.
>
> I will conjecture that these conditions are sufficient to determine
> which k have solutions.  How large a prime you have to check to ensure
> that k does not fail any of these tests is not obvious to me.
>
> Definitely not trivial, and definitely worth including.
>
>
>
> -----Original Message-----
> From: Joerg Arndt <arndt at jjj.de>
> ...
>
> Some Diophantinista may want to enter seq
> k such that n*(n+1)+k can be square.
> (might be unworthy if trivial for some reason).
> Quick & dirty:
> ?
> for(k=0,20,q=0;for(n=1,10000,t=n*(n+1)/2+k;if(issquare(t),q=1;break()));
>
> if(q,
> print1(k,", ")))
> 0, 1, 3, 4, 6, 8, 9, 10, 13, 15, 16, 19,
> seq. not in OEIS, neither complement,
> neither for negative k.
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>
>

```