login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the remainder when n is divided by its binary reverse.
3

%I #18 Mar 01 2021 11:53:54

%S 0,0,0,0,0,0,0,0,0,0,11,0,2,0,0,0,0,0,19,0,0,9,23,0,6,4,0,0,6,0,0,0,0,

%T 0,35,0,37,13,39,0,4,0,43,5,0,17,47,0,14,12,0,8,10,0,55,0,18,12,4,0,

%U 14,0,0,0,0,0,67,0,69,21,71,0,0,33,75,1,77,21

%N a(n) is the remainder when n is divided by its binary reverse.

%C The binary reverse of a number is given by A030101.

%C This sequence is the analog of A071955 for the binary base.

%H Rémy Sigrist, <a href="/A342123/b342123.txt">Table of n, a(n) for n = 1..8192</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = n mod A030101(n).

%F a(n) <= n with equality iff n belongs to A161601.

%F a(n) = 0 iff n belongs to A057890.

%e For n = 43,

%e - the binary reverse of 43 ("101011" in binary) is 53 ("110101" in binary),

%e - so a(43) = 43 mod 53 = 43.

%o (PARI) a(n, base=2) = { my (r=fromdigits(Vecrev(digits(n, base)), base)); n%r }

%o (Python)

%o def A342123(n): return n % int(bin(n)[:1:-1],2) if n > 0 else 0 # _Chai Wah Wu_, Mar 01 2021

%Y Cf. A030101, A057890, A071955, A161601, A342121, A342122.

%K nonn,base,look,easy

%O 1,11

%A _Rémy Sigrist_, Feb 28 2021