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.

A370427 a(n) is the least k >= 0 such that n OR k is a binary palindrome (where OR denotes the bitwise OR operator).

This page as a plain text file.
%I A370427 #13 Feb 21 2024 02:18:11
%S A370427 0,0,1,0,1,0,1,0,1,0,5,4,3,2,1,0,1,0,9,8,1,0,9,8,3,2,1,0,3,2,1,0,1,0,
%T A370427 17,16,9,8,25,24,5,4,21,20,1,0,17,16,3,2,1,0,11,10,9,8,7,6,5,4,3,2,1,
%U A370427 0,1,0,33,32,17,16,49,48,1,0,33,32,17,16,49,48
%N A370427 a(n) is the least k >= 0 such that n OR k is a binary palindrome (where OR denotes the bitwise OR operator).
%C A370427 The binary expansions of n and a(n) have no common 1's.
%H A370427 Paolo Xausa, <a href="/A370427/b370427.txt">Table of n, a(n) for n = 0..16383</a>
%H A370427 Rémy Sigrist, <a href="/A370427/a370427.png">Scatterplot of (x, y) such that x OR y is a binary palindrome and x, y < 2^10</a>
%H A370427 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%H A370427 <a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a>
%F A370427 n AND a(n) = 0 (where AND denotes the bitwise AND operator).
%F A370427 a(n) = A030101(n) - (n AND A030101(n)).
%F A370427 a(n) = A030101(n) - A175297(n) (for any n > 0).
%F A370427 a(n) = 0 iff n belongs to A006995.
%e A370427 The first terms, alongside the corresponding binary expansions, are:
%e A370427   n   a(n)  bin(n)  bin(a(n))  bin(n OR a(n))
%e A370427   --  ----  ------  ---------  --------------
%e A370427    0     0       0          0               0
%e A370427    1     0       1          0               1
%e A370427    2     1      10          1              11
%e A370427    3     0      11          0              11
%e A370427    4     1     100          1             101
%e A370427    5     0     101          0             101
%e A370427    6     1     110          1             111
%e A370427    7     0     111          0             111
%e A370427    8     1    1000          1            1001
%e A370427    9     0    1001          0            1001
%e A370427   10     5    1010        101            1111
%e A370427   11     4    1011        100            1111
%e A370427   12     3    1100         11            1111
%e A370427   13     2    1101         10            1111
%e A370427   14     1    1110          1            1111
%e A370427   15     0    1111          0            1111
%t A370427 A370427[n_] := With[{r = IntegerReverse[n, 2]}, r - BitAnd[n, r]];
%t A370427 Array[A370427, 2^7, 0] (* _Paolo Xausa_, Feb 20 2024 *)
%o A370427 (PARI) a(n) = my (r = fromdigits(Vecrev(binary(n)), 2)); r - bitand(n, r)
%Y A370427 Cf. A006995, A030101, A175297, A344220 (XOR variant).
%K A370427 nonn,base,easy,look
%O A370427 0,11
%A A370427 _Rémy Sigrist_, Feb 18 2024