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.
%I A062128 #17 Apr 19 2025 18:08:00 %S A062128 0,1,11,11,101,101,1001,111,1001,1001,1111,11011,1111,11011,10101, %T A062128 1111,10001,10001,11011,1100011,1100011,10101,-1,111111,11011,1100011, %U A062128 -1,11011,-1,111111,101101,11111,100001,100001,110011,-1,101101,-1,111111,1100011,101101,-1,111111,1100011,1100011 %N A062128 In base 2: start with n; if palindrome, stop; otherwise add to itself with digits reversed; a(n) gives palindrome at which it stops, or -1 if no palindrome is ever reached. %C A062128 The analog of A033865 in base 2. %H A062128 Klaus Brockhaus, <a href="/A058042/a058042.txt">On the'Reverse and Add!' algorithm in base 2</a> %H A062128 <a href="/index/Res#RAA">Index entries for sequences related to Reverse and Add!</a> %e A062128 23: 10111 -> 10111 + 11101 = 110100 -> 110100 + 1011 = 111111, so a(23) = 111111. %t A062128 limit = 10^4; (* Assumes that there is no palindrome if none is found before "limit" iterations *) %t A062128 BaseForm[Table[np = n; i = 0; %t A062128 While[np != IntegerReverse[np, 2] && i < limit, %t A062128 np = np + IntegerReverse[np, 2]; i++]; %t A062128 If[i >= limit, -1, np], {n, 0, 44}], 2] (* _Robert Price_, Oct 14 2019 *) %o A062128 (ARIBAS) stop := 500; for k := 0 to 60 do c := 0; m := k; rev := bit_reverse(m); while m <> rev and c < stop do inc(c); m := m + rev; rev := bit_reverse(m); end; if c < stop then bit_write(m); else write(-1); end; write(" "); end; %Y A062128 Cf. A033865, A062129, A062130, A058042. %K A062128 base,easy,sign %O A062128 0,3 %A A062128 _Klaus Brockhaus_, Jun 06 2001