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.

A377414 a(n) is the largest term of A126684, say b, such that n AND b = b (where AND denotes the bitwise AND operator).

This page as a plain text file.
%I A377414 #16 Jul 02 2025 17:30:36
%S A377414 0,1,2,2,4,5,4,5,8,8,10,10,8,8,10,10,16,17,16,17,20,21,20,21,16,17,16,
%T A377414 17,20,21,20,21,32,32,34,34,32,32,34,34,40,40,42,42,40,40,42,42,32,32,
%U A377414 34,34,32,32,34,34,40,40,42,42,40,40,42,42,64,65,64,65
%N A377414 a(n) is the largest term of A126684, say b, such that n AND b = b (where AND denotes the bitwise AND operator).
%C A377414 For any n > 0 with binary expansion (b_1 = 1, b_2, ..., b_k), the binary expansion of a(n) is (c_1, ..., c_k) where c_i = b_i when i is odd, c_i = 0 when i is even.
%C A377414 For any n, the value c = n - a(n) also belongs to A126684 and satisfies n AND c = c (see A377415).
%H A377414 Rémy Sigrist, <a href="/A377414/b377414.txt">Table of n, a(n) for n = 0..8191</a>
%H A377414 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A377414 a(n) <= n with equality iff n belongs to A126684.
%F A377414 a(a(n)) = a(n).
%F A377414 a(2*n) = 2*a(n).
%F A377414 a(n) = n AND A000975(A070939(n)). - _Alan Michael Gómez Calderón_, Jun 27 2025
%e A377414 The first terms, in decimal and in binary, are:
%e A377414   n   a(n)  bin(n)  bin(a(n))
%e A377414   --  ----  ------  ---------
%e A377414    0     0       0          0
%e A377414    1     1       1          1
%e A377414    2     2      10         10
%e A377414    3     2      11         10
%e A377414    4     4     100        100
%e A377414    5     5     101        101
%e A377414    6     4     110        100
%e A377414    7     5     111        101
%e A377414    8     8    1000       1000
%e A377414    9     8    1001       1000
%e A377414   10    10    1010       1010
%e A377414   11    10    1011       1010
%e A377414   12     8    1100       1000
%e A377414   13     8    1101       1000
%e A377414   14    10    1110       1010
%e A377414   15    10    1111       1010
%o A377414 (PARI) a(n) = { my (v = 0, x = exponent(n), y); while (n, n -= 2^y = exponent(n); if (x%2 == y%2, v += 2^y;);); return (v); }
%Y A377414 See A063694, A063695 and A374356 for similar sequences.
%Y A377414 Cf. A000975, A070939, A126684, A371442, A377415.
%K A377414 nonn,base,easy
%O A377414 0,3
%A A377414 _Rémy Sigrist_, Oct 27 2024