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”).
%I #16 Dec 05 2024 15:33:37
%S 3,6,7,8,9,12,15,16,17,18,19,20,21,22,23,24,25,26,27,30,33,34,35,36,
%T 39,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
%U 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,84
%N Positions of 1 in A189820; complement of A003278.
%H G. C. Greubel, <a href="/A189822/b189822.txt">Table of n, a(n) for n = 1..10000</a>
%t a[1] = 0; h = 50;
%t Table[a[3 k - 2] = a[k], {k, 1, h}];
%t Table[a[3 k - 1] = a[k], {k, 1, h}];
%t Table[a[3 k] = 1, {k, 1, h}];
%t Flatten[Position[%%, 1]]
%o (Python)
%o from gmpy2 import digits
%o def A189822(n):
%o def f(x):
%o l = (s:=digits(x-1,3)).find('2')
%o if l >= 0: s = s[:l]+'1'*(len(s)-l)
%o return n+1+int(s,2)
%o m, k = n, f(n)
%o while m != k: m, k = k, f(k)
%o return m # _Chai Wah Wu_, Dec 05 2024
%Y Cf. A081610, A189820, A003278.
%K nonn,easy,changed
%O 1,1
%A _Clark Kimberling_, Apr 28 2011