OFFSET
1,3
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
MATHEMATICA
Select[Range[0, 100], DigitCount[#, 2, 1]!=2&] (* Harvey P. Dale, Mar 11 2013 *)
PROG
(PARI) isok(n) = hammingweight(n) != 2; \\ Michel Marcus, Nov 01 2019
(Python)
from itertools import count, islice
from math import comb
def A161989(n):
def f(x):
s = bin(x)[2:]
c = n-1+comb((l:=len(s))-1, 2)
try:
c += l-1-s[1:].index('1')
except:
pass
return c
m, k = n-1, f(n-1)
while m != k: m, k = k, f(k)
return m
def A161989_gen(): # generator of terms
return filter(lambda n:n.bit_count()!=2, count(0))
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jun 24 2009
STATUS
approved
