login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A189822
Positions of 1 in A189820; complement of A003278.
3
3, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 33, 34, 35, 36, 39, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 84
OFFSET
1,1
LINKS
MATHEMATICA
a[1] = 0; h = 50;
Table[a[3 k - 2] = a[k], {k, 1, h}];
Table[a[3 k - 1] = a[k], {k, 1, h}];
Table[a[3 k] = 1, {k, 1, h}];
Flatten[Position[%%, 1]]
PROG
(Python)
from gmpy2 import digits
def A189822(n):
def f(x):
l = (s:=digits(x-1, 3)).find('2')
if l >= 0: s = s[:l]+'1'*(len(s)-l)
return n+1+int(s, 2)
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m # Chai Wah Wu, Dec 05 2024
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
Clark Kimberling, Apr 28 2011
STATUS
approved