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.

A383976 In the binary expansion of n, expand bits 1 -> 11 and 0 -> 10.

Original entry on oeis.org

2, 3, 14, 15, 58, 59, 62, 63, 234, 235, 238, 239, 250, 251, 254, 255, 938, 939, 942, 943, 954, 955, 958, 959, 1002, 1003, 1006, 1007, 1018, 1019, 1022, 1023, 3754, 3755, 3758, 3759, 3770, 3771, 3774, 3775, 3818, 3819, 3822, 3823, 3834, 3835, 3838, 3839, 4010, 4011, 4014
Offset: 0

Views

Author

DarĂ­o Clavijo, May 16 2025

Keywords

Comments

This is essentially the differential Manchester encoding or FM:(0,1) RLL.
Terms come in groups of two and all terms have even bitsize.
In this case, by convention, 0 is treated as a single 0 bit and leading zeros in other terms are omitted.

Crossrefs

Programs

  • Maple
    a:= n-> 2+(n mod 2)+`if`(n<2, 0, 4*a(iquo(n, 2))):
    seq(a(n), n=0..50);  # Alois P. Heinz, May 16 2025
  • Mathematica
    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 *)
  • Python
    a = lambda n: int(bin(n)[2:].replace('1','3').replace('0','2'),4)
    print([a(n) for n in range(0,51)])

Formula

a(n) = a(n-1) + 1 for n odd.
a(n) = 2 + (n mod 2) + 4*a(floor(n/2)) if n >= 2 else 2 + (n mod 2).
a(n) = Sum_{k=0..floor(log_2(n))} 4^k*(2+b_k), where b_k is the k-th bit of n.