%I #29 May 26 2021 08:32:19
%S 1,1,1,0,2,0,1,0,3,0,2,0,4,0,1,0,8,0,2,0,4,0,4,0,8,0,2,0,24,0,2,0,8,0,
%T 8,0,8,0,2,0,32,0,4,0,16,0,4,0,32,0,4,0,32,0,4,0,4,0,8,0,16,0,2,0,32,
%U 0,6,0,48,0,16,0,16,0,8,0,384,0,4,0,16,0,16,0,16,0,8,0,768,0,2,0,8,0,4,0,32,0,32,0,256
%N Numbers of pairs {x, y} such that x <= y and triangular(x) + triangular(y) = 2^n.
%C Conjectures:
%C 1. a(n) = 0 for odd n > 1.
%C 2. a(n) is even for even n > 14.
%H Antti Karttunen, <a href="/A224928/b224928.txt">Table of n, a(n) for n = 0..329</a>
%F a(n) = A052343(2^n).
%e 2^1 = 1 + 1, the only representation of 2 as a sum of two triangular numbers, so a(1)=1.
%e 2^4 = 16 = 1+15 = 6+10, two representations, so a(4) = 2.
%e 2^8 = 256 = 3+253 = 66+190 = 120+136, so a(8) = 3.
%e 2^12 = 4096 = 1+4095 = 91+4005 = 1540+2556 = 2016+2080, so a(12) = 4.
%o (C)
%o #include <stdio.h>
%o #include <math.h>
%o typedef unsigned long long U64;
%o U64 isTriangular(U64 a) { // ! Must be a <= (1<<63)
%o U64 s = sqrt(a*2);
%o if (a>=(1ULL<<63)) {
%o if (a==(1ULL<<63)) return 0;
%o printf("Error: a = %llu\n", a), exit(1);
%o }
%o return (s*(s+1)/2 == a);
%o }
%o int main() {
%o U64 c, n, x, tx;
%o for (n = 1; n; n+=n) {
%o for (c = x = tx = 0; tx*2 <= n; ++x, tx+=x)
%o if (isTriangular(n - tx))
%o ++c;//, printf("(%llu+%llu) ", tx, n-tx);
%o printf("%llu, ", c);
%o }
%o return 0;
%o }
%o (PARI)
%o A008441(n) = if(!n,n,sumdiv(4*n + 1, d, (d%4==1) - (d%4==3)));
%o A052343(n) = if(!n,1,my(u=A008441(n)); ((u\2)+(u%2)));
%o A224928(n) = A052343(2^n); \\ _Antti Karttunen_, May 24 2021
%Y Cf. A000217, A052343, A006307, A225437.
%K nonn
%O 0,5
%A _Alex Ratushnyak_, May 08 2013
%E More terms from _Antti Karttunen_, May 24 2021