%I #10 Oct 14 2019 21:09:19
%S 0,1,3,3,5,5,9,7,9,9,15,27,15,27,21,15,17,17,27,99,99,21,-1,63,27,99,
%T -1,27,-1,63,45,31,33,33,51,-1,45,-1,63,99,45,-1,63,99,99,45,-1,-1,51,
%U -1,255,51,63,99,255,153,63,99,255,153,-1,-1,93,63,65,65,99,-1,85,255,119,387,255,73,13299,-1,387,-1,-1,219,85
%N A062128 written in base 10.
%H <a href="/index/Res#RAA">Index entries for sequences related to Reverse and Add!</a>
%H Klaus Brockhaus, <a href="/A058042/a058042.txt">On the'Reverse and Add!' algorithm in base 2</a>
%e 23 -> 23 + 29 = 52 -> 52 + 11 = 63, so a(23) = 63.
%t limit = 10^4; (* Assumes that there is no palindrome if none is found before "limit" iterations *)
%t Table[np = n; i = 0;
%t While[np != IntegerReverse[np, 2] && i < limit,
%t np = np + IntegerReverse[np, 2]; i++];
%t If[i >= limit, -1, np], {n, 0, 80}] (* _Robert Price_, Oct 14 2019 *)
%o (ARIBAS): stop := 500; for k := 0 to 80 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 write(m); else write(-1); end; write(" "); end;.
%Y A033865, A062128, A062131, A061561.
%K base,easy,sign
%O 0,3
%A _Klaus Brockhaus_, Jun 06 2001