cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A189822 Positions of 1 in A189820; complement of A003278.

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