A345348 Triangular numbers that in base 2 have the same number of 0's and 1's.
10, 153, 210, 595, 666, 820, 2278, 2701, 9045, 9870, 10585, 11476, 12403, 13366, 13861, 14365, 34191, 34716, 35245, 36046, 37675, 37950, 39340, 39621, 40470, 41905, 42195, 42778, 43365, 44551, 45150, 45451, 46665, 48516, 49455, 50086, 50403, 51681, 52003, 52326
Offset: 1
Examples
Triangular number 153 = '10011001' in binary, the number of 1's equals the number of 0's, so 153 is a term.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Select[Table[n*(n + 1)/2, {n, 0, 330}], Equal @@ DigitCount[#, 2] &] (* Amiram Eldar, Jun 15 2021 *)
-
PARI
isA031443(n)=2*hammingweight(n)==exponent(n)+1 list(lim)=my(v=List(),n=4,t); while((t=n*n++/2)<=lim, if(isA031443(t), listput(v,t))); Vec(v) \\ Charles R Greathouse IV, Jun 21 2021
-
Python
A345348_list = [n for n in (m*(m+1)//2 for m in range(10**6)) if len(bin(n))-2 == 2*bin(n).count('1')] # Chai Wah Wu, Jun 21 2021
Extensions
More terms from Jinyuan Wang, Jun 15 2021