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 A383976 #30 May 21 2025 23:36:39 %S A383976 2,3,14,15,58,59,62,63,234,235,238,239,250,251,254,255,938,939,942, %T A383976 943,954,955,958,959,1002,1003,1006,1007,1018,1019,1022,1023,3754, %U A383976 3755,3758,3759,3770,3771,3774,3775,3818,3819,3822,3823,3834,3835,3838,3839,4010,4011,4014 %N A383976 In the binary expansion of n, expand bits 1 -> 11 and 0 -> 10. %C A383976 This is essentially the differential Manchester encoding or FM:(0,1) RLL. %C A383976 Terms come in groups of two and all terms have even bitsize. %C A383976 In this case, by convention, 0 is treated as a single 0 bit and leading zeros in other terms are omitted. %H A383976 Wikipedia, <a href="https://en.wikipedia.org/wiki/Run-length_limited#FM:_.280.2C1.29_RLL">Run-length limited</a> %F A383976 a(n) = a(n-1) + 1 for n odd. %F A383976 a(n) = 2 + (n mod 2) + 4*a(floor(n/2)) if n >= 2 else 2 + (n mod 2). %F A383976 a(n) = Sum_{k=0..floor(log_2(n))} 4^k*(2+b_k), where b_k is the k-th bit of n. %p A383976 a:= n-> 2+(n mod 2)+`if`(n<2, 0, 4*a(iquo(n, 2))): %p A383976 seq(a(n), n=0..50); # _Alois P. Heinz_, May 16 2025 %t A383976 a[n_] := a[n] = 2 + Mod[n, 2] + If[n < 2, 0, 4*a[Floor[n/2]]];Array[a, 51, 0] (* _Shenghui Yang_, May 21 2025 *) %o A383976 (Python) %o A383976 a = lambda n: int(bin(n)[2:].replace('1','3').replace('0','2'),4) %o A383976 print([a(n) for n in range(0,51)]) %Y A383976 Cf. A000523, A374625. %K A383976 nonn,base,easy %O A383976 0,1 %A A383976 _DarĂo Clavijo_, May 16 2025