login
A363710
a(n) is the number of pairs of nonnegative integers (x, y) such that x + y = n and A003188(x) AND A003188(y) = 0 (where AND denotes the bitwise AND operator).
3
1, 2, 2, 2, 4, 4, 2, 2, 4, 8, 6, 4, 6, 4, 2, 2, 4, 8, 10, 8, 12, 12, 6, 4, 6, 12, 8, 4, 6, 4, 2, 2, 4, 8, 10, 8, 16, 20, 10, 8, 12, 24, 20, 12, 16, 12, 6, 4, 6, 12, 16, 12, 16, 16, 8, 4, 6, 12, 8, 4, 6, 4, 2, 2, 4, 8, 10, 8, 16, 20, 10, 8, 16, 32, 28, 20, 28
OFFSET
0,2
COMMENTS
Equivalently, a(n) is the number of k >= 0 such that A332497(k) + A332498(k) = n.
The set of pairs of nonnegative integers (x, y) such that A003188(x) AND A003188(y) = 0 is related to the T-square fractal (see illustration in Links section).
FORMULA
a(n) = 2 iff n belongs to A075427.
EXAMPLE
For n = 8:
- we have:
k A332497(8-k) A332497(k) A332497(8-k) AND A332497(k)
- ------------ ---------- ---------------------------
0 12 0 0
1 4 1 0
2 5 3 1
3 7 2 2
4 6 6 6
5 2 7 2
6 3 5 1
7 1 4 0
8 0 12 0
- so a(8) = 4.
MATHEMATICA
A131218[n_, k_]:= Boole[BitAnd[BitXor[n, BitShiftRight[n, 1]], BitXor[k, BitShiftRight[k, 1]]] ==0];
A363710[n_]:= A363710[n]= Sum[A131218[n-k, k], {k, 0, n}];
Table[A363710[n], {n, 0, 100}] (* G. C. Greubel, Sep 06 2025 *)
PROG
(PARI) a(n) = 2*sum(k=0, n\2, bitand(bitxor(n-k, (n-k)\2), bitxor(k, k\2))==0) - (n==0)
(Python) A363710=lambda n: sum(map(lambda k: not (k^k>>1)&(n-k^n-k>>1), range(n+1>>1)))<<1 if n else 1 # Natalia L. Skirrow, Jun 22 2023
(Magma)
A131218:= func< n, k | BitwiseAnd(BitwiseXor(n, ShiftRight(n, 1)), BitwiseXor(k, ShiftRight(k, 1))) eq 0 select 1 else 0 >;
A363710:= func< n | (&+[A131218(n-k, k): k in [0..n]]) >;
[A363710(n): n in [0..100]]; // G. C. Greubel, Sep 06 2025
(SageMath)
def A363710(n): return sum(int( ((n-k)^^((n-k)>>1)) & (k^^(k>>1)) ==0) for k in range(n+1))
print([A363710(n) for n in range(101)]) # G. C. Greubel, Sep 06 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 17 2023
STATUS
approved