OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
MAPLE
q:= n-> issqr(8*add(i, i=Bits[Split](n))+1):
select(q, [$0..200])[]; # Alois P. Heinz, May 24 2021
MATHEMATICA
Select[Range[0, 200], IntegerQ @ Sqrt[8 * Plus @@ IntegerDigits[#, 2] + 1] &] (* Amiram Eldar, May 24 2021 *)
PROG
(PARI) isok(n) = ispolygonal(hammingweight(n), 3);
(Python)
from math import isqrt, comb
from sympy.ntheory.primetest import is_square
from oeis_sequences.OEISsequences import bisection
def A344602(n):
def f(x):
s = bin(x)[-1:1:-1]
m = x.bit_count()
l = x.bit_length()
l2 = (k:=isqrt(t:=l+1<<1))+int((t<<2)>(k<<2)*(k+1)+1)
a = is_square((m<<3)|1)
c = n+x-a
for i in range(l):
j = int(s[i])
if j:
m -= 1
r = (k:=isqrt(t:=m+1<<1))+int((t<<2)>(k<<2)*(k+1)+1)-1
for p in range(r+(not is_square((m<<3)|1)), l2):
c -= comb(i, comb(p+1, 2)-m)
return c
return bisection(f, n-1, n-1) # Chai Wah Wu, Jun 09 2026
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michel Marcus, May 24 2021
STATUS
approved
