is this sequence interesting?

Max Alekseyev maxale at gmail.com
Mon Mar 31 12:47:44 CEST 2008


On Sat, Mar 29, 2008 at 7:42 PM, Peter Pein <petsie at dordos.net> wrote:
> Dear Seq-fans,
>
>  let t(k)=k*(k+1)/2 be the k-th triangular number and write n>=2 as difference
>  of two positive triangular numbers: n = t(k) - t(j).
>
>  Now define a(n) as the minimal k needed for the minuend:
>
>  a(n) := min(k > 0: there exists j>0 with n = t(k)-t(j) )

Note that if n = t(k)-t(j) implies 2n = (k-j)(k+j+1), where (k-j) and
(k+j+1) are of opposite oddness.

Let d be the odd element of { k-j, k+j+1 }. Then d is an odd divisor
of n and k = ( d + 2n/d - 1 ) / 2. Therefore,
a(n) = ( min{ d + 2n/d } - 1 ) / 2
where d goes over all odd divisors of n, except maybe (sqrt(8*n+1) +/-
1)/2 which correspond to j=0.

This is PARI/GP implementation:

{ a(n) = local(m); m=2*n+1;
fordiv(n/2^valuation(n,2),d,if((2*d+1)^2!=8*n+1&&(2*d-1)^2!=8*n+1,m=min(m,d+(2*n)\d)));
(m-1)\2 }

? vector(100,n,a(n))
%1 = [1, 2, 3, 4, 3, 6, 4, 8, 4, 10, 6, 5, 7, 5, 6, 16, 9, 6, 10, 6,
8, 7, 12, 9, 7, 8, 7, 28, 15, 8, 16, 32, 8, 10, 8, 13, 19, 11, 9, 10,
21, 9, 22, 9, 10, 13, 24, 17, 10, 12, 11, 10, 27, 10, 13, 11, 12, 16,
30, 11, 31, 17, 11, 64, 11, 18, 34, 12, 14, 13, 36, 12, 37, 20, 12,
13, 12, 21, 40, 18, 13, 22, 42, 14, 13, 23, 17, 13, 45, 13, 16, 15,
18, 25, 14, 33, 49, 17, 14, 16]

P.S. btw, the restriction j>0 looks artificial to me. what's wrong
with j=0? If we drop this restriction then we get sequence:

{ b(n) = local(m); m=2*n+1;
fordiv(n/2^valuation(n,2),d,m=min(m,d+(2*n)\d)); (m-1)\2 }

? vector(100,n,b(n))
%1 = [1, 2, 2, 4, 3, 3, 4, 8, 4, 4, 6, 5, 7, 5, 5, 16, 9, 6, 10, 6, 6,
7, 12, 9, 7, 8, 7, 7, 15, 8, 16, 32, 8, 10, 8, 8, 19, 11, 9, 10, 21,
9, 22, 9, 9, 13, 24, 17, 10, 12, 11, 10, 27, 10, 10, 11, 12, 16, 30,
11, 31, 17, 11, 64, 11, 11, 34, 12, 14, 13, 36, 12, 37, 20, 12, 13,
12, 12, 40, 18, 13, 22, 42, 14, 13, 23, 17, 13, 45, 13, 13, 15, 18,
25, 14, 33, 49, 17, 14, 16]

This sequence is also missing in OEIS.

Regards,
Max





More information about the SeqFan mailing list