login
Numbers having at least one 1 in their ternary representation.
11

%I #32 Oct 29 2024 12:39:55

%S 1,3,4,5,7,9,10,11,12,13,14,15,16,17,19,21,22,23,25,27,28,29,30,31,32,

%T 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,55,57,

%U 58,59,61,63,64,65,66,67,68,69,70,71,73,75,76,77,79,81,82,83,84,85,86

%N Numbers having at least one 1 in their ternary representation.

%C Complement of A005823.

%C Integers m such that central Delannoy number A001850(m) == 0 (mod 3). - _Emeric Deutsch_ and _Bruce E. Sagan_, Dec 04 2003

%C Integers m such that A026375(m) == 0 (mod 3). - _Fabio VisonĂ _, Aug 03 2023

%H Johann Cigler, <a href="https://arxiv.org/abs/1611.05252">Some elementary observations on Narayana polynomials and related topics</a>, arXiv:1611.05252 [math.CO], 2016. See p.25.

%H Mathematics Stack Exchange, <a href="https://math.stackexchange.com/a/4746447/573047">Proof that integers m in this sequence are such that A026375(m) == 0 (mod 3)</a>.

%t Select[Range[100],DigitCount[#,3,1]>0&] (* _Harvey P. Dale_, Nov 26 2022 *)

%o (Python)

%o from itertools import count, islice

%o def A081606_gen(): # generator of terms

%o a = 0

%o for n in count(1):

%o b = int(bin(n)[2:],3)<<1

%o yield from range(a+1,b)

%o a = b

%o A081606_list = list(islice(A081606_gen(),30)) # _Chai Wah Wu_, Oct 13 2023

%o (Python)

%o from gmpy2 import digits

%o def A081606(n):

%o def f(x):

%o s = digits(x>>1,3)

%o for i in range(l:=len(s)):

%o if s[i]>'1':

%o break

%o else:

%o return n+int(s,2)

%o return n-1+(int(s[:i] or '0',2)+1<<l-i)

%o m, k = n, f(n)

%o while m != k: m, k = k, f(k)

%o return m # _Chai Wah Wu_, Oct 29 2024

%Y Cf. A007089, A062756, A081609, A081605, A074940.

%K nonn,base

%O 1,2

%A _Reinhard Zumkeller_, Mar 23 2003

%E More terms from _Emeric Deutsch_ and _Bruce E. Sagan_, Dec 04 2003