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 A380110 #74 Feb 27 2025 07:57:09 %S A380110 0,1,1,2,4,5,5,6,4,5,5,6,8,9,9,10,16,17,17,18,20,21,21,22,20,21,21,22, %T A380110 24,25,25,26,16,17,17,18,20,21,21,22,20,21,21,22,24,25,25,26,32,33,33, %U A380110 34,36,37,37,38,36,37,37,38,40,41,41,42,64,65,65,66,68,69 %N A380110 In the base 4 expansion of n: map 0->0, 1->1, 2->1, 3->2. %C A380110 This is essentialy the mapping of the half adder where the inputs A,B maps to outputs: C_out and S as in binary: 00->00, 01->01, 10->01, 11->10, where C_out is the carry out bit and S is the sum bit. %C A380110 The fixed points for this sequence are in the Moser-de Bruijn sequence (A000695). %H A380110 Paolo Xausa, <a href="/A380110/b380110.txt">Table of n, a(n) for n = 0..10000</a> %H A380110 Wikipedia, <a href="https://en.wikipedia.org/wiki/Adder_(electronics)">Adder (electronics)</a> %F A380110 a(n) = n iff n in A000695. %F A380110 a(2^k) = A213173(n). %F A380110 a(n) = a(n-1)+1 if n odd. %F A380110 a(n) = n-A063695(n)/2. %e A380110 Half adder truth table: %e A380110 A | B | C_out | S %e A380110 ---+---+-------+------ %e A380110 0 | 0 | 0 | 0 %e A380110 0 | 1 | 0 | 1 %e A380110 1 | 0 | 0 | 1 %e A380110 1 | 1 | 1 | 0 %e A380110 For n = 25 a(25) = 21 because: %e A380110 25 = 121_4 and 121_4 maps to 111_4 which is 21. %t A380110 A380110[n_] := FromDigits[ReplaceAll[IntegerDigits[n, 4], {2 -> 1, 3 -> 2}], 4]; %t A380110 Array[A380110, 100, 0] (* _Paolo Xausa_, Feb 27 2025 *) %o A380110 (Python) %o A380110 def a(n): %o A380110 r,p = 0,1 %o A380110 while n: %o A380110 ps = (n & 1) + ((n >> 1) & 1) %o A380110 r += ps * p %o A380110 n >>= 2 %o A380110 p <<= 2 %o A380110 return r %o A380110 print([a(n) for n in range(70)]) %Y A380110 Cf. A000079, A000695, A063695, A213173. %K A380110 nonn,base,easy %O A380110 0,4 %A A380110 _DarĂo Clavijo_, Feb 14 2025