# [seqfan] Re: Sequence related to A180919

Robert Israel israel at math.ubc.ca
Wed Jan 19 21:44:49 CET 2011

```Here's a Maple procedure for this.  Note that I've removed the solutions
with k=0.

A:= proc(n::posint)
local m,f;
uses numtheory;
if n = 1 then return 0
elif n = 2 then return infinity
elif n mod 4 = 0 then
m:= n/2;
f:= divisors(m^2 - 1) minus {m-1,m+1}
elif n mod 4 = 2 then
m:= n/2;
f:= divisors((m^2-1)/4) minus {(m-1)/2,(m+1)/2}
else
m:= (n-1)/2;
f:= divisors((2*m+3)*(2*m-1)) minus {2*m+3,2*m-1}
end if;
nops(f)/2;
end proc;

For example:

> seq([n,A(n)], n=1 .. 100);

[1, 0], [2, infinity], [3, 0], [4, 0], [5, 1], [6, 0], [7, 2], [8, 1], [9,
1], [10, 1], [11, 2], [12, 1], [13, 3], [14, 2], [15, 1], [16, 2], [17,
3], [18, 2], [19, 3], [20, 2], [21, 1], [22, 3], [23, 5], [24, 1], [25,
3], [26, 3], [27, 2], [28, 3], [29, 3], [30, 3], [31, 3], [32, 3], [33,
3], [34, 5], [35, 3], [36, 1], [37, 7], [38, 5], [39, 1], [40, 3], [41,
3], [42, 3], [43, 5], [44, 3], [45, 1], [46, 5], [47, 8], [48, 2], [49,
3], [50, 5], [51, 2], [52, 5], [53, 7], [54, 3], [55, 3], [56, 3], [57,
3], [58, 7], [59, 3], [60, 1], [61, 5], [62, 9], [63, 3], [64, 3], [65,
5], [66, 4], [67, 7], [68, 7], [69, 1], [70, 5], [71, 3], [72, 3], [73,
5], [74, 5], [75, 3], [76, 3], [77, 5], [78, 5], [79, 9], [80, 3], [81,
1], [82, 11], [83, 9], [84, 1], [85, 3], [86, 7], [87, 3], [88, 5], [89,
7], [90, 3], [91, 3], [92, 5], [93, 7], [94, 7], [95, 3], [96, 2], [97,
11], [98, 11], [99, 1], [100, 5]

I don't know if we want "infinity" as the member of the sequence for n=2,
though.

Robert Israel                                israel at math.ubc.ca
Department of Mathematics        http://www.math.ubc.ca/~israel
University of British Columbia            Vancouver, BC, Canada

On Tue, 18 Jan 2011, Robert Israel wrote:

> I'm not "heavy duty" by any means, but if n is even (say n = 2*m),
> x^2 = k^2 + 2*m*k + 1 becomes
> (k+m+x)(k+m-x) = m^2 - 1
> and the number of nonnegative integer solutions is the number of ways to
> write m^2 - 1 as the (unordered) product of two nonnegative integers that are
> either both odd (if m is even) or both even (if m is odd).  For example, with
> n=10, m=5, 24 = 2*12 = 4*6 corresponding to the solutions (k=2,x=5) and
> (k=0,x=1), while with n=16, m=8, 63 = 1*63 = 3*21 = 7*9
> corresponding to the solutions (k=24,x=31), (k=4,x=9) and (k=0,x=1).
>
> If n is odd (say n=2*m+1), x^2=k^2+(2*m+1)*k+1 becomes
> (2*k+2*m+1-2*x)*(2*k+2*m+1+2*x) = (2*m+3)*(2*m-1)
> and solutions correspond to ways to write (2*m+3)*(2*m-1) as the
> product of two nonnegative odd integers.  For example, with
> n=11, m=5, 117 = 1*117 = 3*39 = 9*13 corresponding to (k=24,x=29),
> (k=5,x=9) and (k=0,x=1).
>
> Robert Israel                                israel at math.ubc.ca
> Department of Mathematics        http://www.math.ubc.ca/~israel University of
> British Columbia            Vancouver, BC, Canada
>
> On Tue, 18 Jan 2011, Joerg Arndt wrote:
>
>> (If I understood the message correctly)
>> I'd suggest to just create one sequence
>> "Number of squares of the form k^2+n*k+1 where k>0."
>>
>> But first wait for comments from the heavy duty number theorists.
>>
>> * Bruno Berselli <berselli.bruno at yahoo.it> [Jan 18. 2011 17:10]:
>>> [...]
>>
>>
>> _______________________________________________
>>
>> Seqfan Mailing list - http://list.seqfan.eu/
>>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

```