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.
%I A277022 #19 Mar 30 2017 21:42:03 %S A277022 0,1,2,5,6,13,4,9,10,21,22,45,12,25,26,53,54,109,28,57,58,117,118,237, %T A277022 60,121,122,245,246,493,8,17,18,37,38,77,20,41,42,85,86,173,44,89,90, %U A277022 181,182,365,92,185,186,373,374,749,188,377,378,757,758,1517,24,49,50,101,102,205,52,105,106,213,214,429,108,217,218,437,438,877,220 %N A277022 Primorial base representation of n is rewritten as a base-2 number with each nonzero digit k replaced by a run of k 1's (followed by one extra zero if not the rightmost run of 1's) and with each 0 kept as 0. %H A277022 Antti Karttunen, <a href="/A277022/b277022.txt">Table of n, a(n) for n = 0..30030</a> %H A277022 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A277022 <a href="/index/Pri#primorialbase">Index entries for sequences related to primorial base</a> %F A277022 a(0) = 0; for n >= 1, a(n) = A000225(A276088(n))*A000079(A276084(n)) + A000079(A276088(n))*a(A276093(n)). %F A277022 a(n) = A156552(A276086(n)). %F A277022 Other identities. For all n >= 0: %F A277022 A277021(a(n)) = n. %F A277022 A005940(1+a(n)) = A276086(n). %F A277022 A000035(a(n)) = A000035(n). [Preserves the parity of n.] %F A277022 A000120(a(n)) = A276150(n). %F A277022 A069010(a(n)) = A267263(n). %e A277022 9 = "111" in primorial base (A002110(0) + A002110(1) + A002110(2) = 9) is converted to three 1-bits, with separating zeros, in binary as "10101" = A007088(21), thus a(9) = 21. %e A277022 91 = "3001" in primorial base (91 = 3*A002110(3) + A002110(0)) is converted to binary number "1110001" = A007088(113), thus a(91) = 113. Note how two of the zeros come from the primorial base representation and the third zero is an extra separating zero inserted after each run of 1-bits apart from the rightmost 1-run. %e A277022 120 = "4000" in primorial base (120 = 4*A002110(3)) is converted to the binary number "1111000" = A007088(120), thus a(120) = 120. %o A277022 (Scheme, two different implementations) %o A277022 (define (A277022 n) (let loop ((n n) (z 0) (i 1) (j 0)) (if (zero? n) z (let* ((p (A000040 i)) (d (remainder n p))) (loop (quotient n p) (+ z (* (A000225 d) (A000079 j))) (+ 1 i) (+ 1 j d)))))) %o A277022 ;; Another one based on given recurrence, utilizing memoization-macro definec: %o A277022 (definec (A277022 n) (if (zero? n) n (+ (* (A000225 (A276088 n)) (A000079 (A276084 n))) (* (A000079 (A276088 n)) (A277022 (A276093 n)))))) %Y A277022 Cf. A000035, A000079, A000120, A000225, A005940, A007088, A049345, A156552, A267263, A276084, A276086, A276088, A276093, A276150. %Y A277022 Cf. A277018 (terms sorted into ascending order). %Y A277022 Cf. A277021 (a left inverse). %Y A277022 Differs from analogous A277012 for the first time at n=24, where a(24) = 60, while A277012(24) = 8. %K A277022 nonn,base %O A277022 0,3 %A A277022 _Antti Karttunen_, Sep 26 2016