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.

A336434 Square array read by descending antidiagonals T(n,k): In the binary expansion of n, reverse the order of the bits in the same position as the active bits in A057716(k).

This page as a plain text file.
%I A336434 #43 Aug 30 2020 03:38:01
%S A336434 2,4,1,1,2,3,4,4,6,4,8,2,5,1,6,1,2,6,2,5,5,8,8,10,1,3,3,7,1,2,9,4,5,6,
%T A336434 7,8,8,2,10,4,12,3,7,8,10,1,2,3,4,5,6,7,8,12,9,8,8,10,8,12,12,14,8,9,
%U A336434 10,11,16,4,9,4,9,6,13,1,12,12,14,12
%N A336434 Square array read by descending antidiagonals T(n,k): In the binary expansion of n, reverse the order of the bits in the same position as the active bits in A057716(k).
%C A336434 T(n,k) is the swapping of the positions of the bits in n according to the active bits in K, where K = A057716(k). The bit in the same position as the first active bit in K switches positions with the bit in the same position as the last active bit in K, the bit in the same position as the second active bit in K switches with the one in the same as the second to last position, and so on until all have swapped (without repeating).
%C A336434 Any sequence, f, of the form "reverse the order of the a-th, b-th, ... and z-th bits in n" can be expressed as f(n) = T(n,k), where A057716(k) = 2^a + 2^b + ... 2^z. As a result, this operation combines 1 or more bit-swapping operations, which could be useful for bit-manipulation in computer programming.
%H A336434 Davis Smith, <a href="/A336434/b336434.txt">Table of n, a(n) for n = 1..5050; the first 100 antidiagonals of the array</a>
%H A336434 S. E. Anderson, <a href="https://graphics.stanford.edu/~seander/bithacks.html#SwappingValuesXOR">Bit Twiddling Hacks</a>.
%F A336434 T(n,k) = A003987(n, Sum_{m=1..floor(M/2)} A003987(A030308(n,A133457(K,m)), A030308(n,A133457(K,M - (m - 1))))* (2^A133457(K,m) + 2^A133457(K,M - (m - 1)))), where K = A057716(k) and M = A000120(A057716(k)).
%F A336434 When A057716(k) = 2^A070939(n) - 1, T(n,k) = A030101(n).
%F A336434 When A057716(k) = 2^(A070939(n) - 1) - 1, T(n,k) = A059893(n).
%e A336434 The binary expansion of 18 is 10010_2 and the active bits in the binary expansion of A057716(22) = 27 = 11011_2 are 0, 1, 3, and 4. So, to get T(18,22), we swap the 0th and 4th bits and then the 1st and 3rd bits, which gives us T(18,22) = 9.
%e A336434 Square array T(n,k) begins:
%e A336434   \k   1   2   3   4   5   6   7   8   9  10 ...
%e A336434   n\
%e A336434    1|  2   4   1   4   8   1   8   1   8   1 ...
%e A336434    2|  1   2   4   2   2   8   2   2   2   8 ...
%e A336434    3|  3   6   5   6  10   9  10   3  10   9 ...
%e A336434    4|  4   1   2   1   4   4   4   8   4   4 ...
%e A336434    5|  6   5   3   5  12   5  12   9  12   5 ...
%e A336434    6|  5   3   6   3   6  12   6  10   6  12 ...
%e A336434    7|  7   7   7   7  14  13  14  11  14  13 ...
%e A336434    8|  8   8   8   8   1   2   1   4   1   2 ...
%e A336434    9| 10  12   9  12   9   3   9   5   9   3 ...
%e A336434   10|  9  10  12  10   3  10   3   6   3  10 ...
%o A336434 (PARI) A336434(n,k)={my(K=k+#binary(k+#binary(k)), P=select(Z->bittest(K,Z),[0..#binary(K)-1]), Q1=P[1..floor(#P/2)],Q2=Vecrev(P)[1..floor(#P/2)], Sum=vecsum(apply(p->if(bittest(n,Q1[p])!=bittest(n,Q2[p]), bitor(shift(1,Q1[p]),shift(1,Q2[p]))), [1..floor(#P/2)])));bitxor(n,Sum)}
%Y A336434 Cf. A000120, A003987, A030101, A030308, A057716, A059893, A070939, A080412 (column k=1), A133457.
%K A336434 nonn,tabl,base
%O A336434 1,1
%A A336434 _Davis Smith_, Jul 21 2020