OFFSET
0,5
COMMENTS
Conjectures:
1. a(n) = 0 for odd n > 1.
2. a(n) is even for even n > 14.
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..329
FORMULA
a(n) = A052343(2^n).
EXAMPLE
2^1 = 1 + 1, the only representation of 2 as a sum of two triangular numbers, so a(1)=1.
2^4 = 16 = 1+15 = 6+10, two representations, so a(4) = 2.
2^8 = 256 = 3+253 = 66+190 = 120+136, so a(8) = 3.
2^12 = 4096 = 1+4095 = 91+4005 = 1540+2556 = 2016+2080, so a(12) = 4.
PROG
(C)
#include <stdio.h>
#include <math.h>
typedef unsigned long long U64;
U64 isTriangular(U64 a) { // ! Must be a <= (1<<63)
U64 s = sqrt(a*2);
if (a>=(1ULL<<63)) {
if (a==(1ULL<<63)) return 0;
printf("Error: a = %llu\n", a), exit(1);
}
return (s*(s+1)/2 == a);
}
int main() {
U64 c, n, x, tx;
for (n = 1; n; n+=n) {
for (c = x = tx = 0; tx*2 <= n; ++x, tx+=x)
if (isTriangular(n - tx))
++c; //, printf("(%llu+%llu) ", tx, n-tx);
printf("%llu, ", c);
}
return 0;
}
(PARI)
A008441(n) = if(!n, n, sumdiv(4*n + 1, d, (d%4==1) - (d%4==3)));
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 08 2013
EXTENSIONS
More terms from Antti Karttunen, May 24 2021
STATUS
approved