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.

A053641 Rotate n one binary digit to the right, drop leading zeros, then rotate one binary digit to the left.

This page as a plain text file.
%I A053641 #32 Jan 16 2024 13:08:44
%S A053641 1,1,3,1,5,3,7,1,9,3,11,5,13,7,15,1,17,3,19,5,21,7,23,9,25,11,27,13,
%T A053641 29,15,31,1,33,3,35,5,37,7,39,9,41,11,43,13,45,15,47,17,49,19,51,21,
%U A053641 53,23,55,25,57,27,59,29,61,31,63,1
%N A053641 Rotate n one binary digit to the right, drop leading zeros, then rotate one binary digit to the left.
%H A053641 Jason Yuen, <a href="/A053641/b053641.txt">Table of n, a(n) for n = 1..10000</a>
%F A053641 a(n) = A006257(A038572(n)).
%F A053641 a(n) = n if n odd, n - 2^k + 1 if n even and 2^k <= n < 2^(k+1).
%e A053641 a(60) = 29 because starting with 111100 the right rotation produces 011110,  written as 11110 (i.e., 30) and the left rotation produces 11101 (i.e., 29).
%t A053641 rtt[f_, n_] := FromDigits[f[IntegerDigits[n, 2]], 2];
%t A053641 Array[rtt[RotateLeft, rtt[RotateRight, #]]&, 100] (* _Paolo Xausa_, Jan 16 2024 *)
%o A053641 (PARI) a(n) = if(bitand(n,1), n, n+1 - 1<<logint(n,2)); \\ _Kevin Ryde_, Jan 13 2024
%Y A053641 Cf. A006257, A038572.
%Y A053641 Cf. A053642 (left then right).
%K A053641 nonn,base,easy
%O A053641 1,3
%A A053641 _Henry Bottomley_, Mar 22 2000