All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Reverse and add in binary (Posted on 2021-04-29) Difficulty: 3 of 5
The reverse and add process, if repeated will often reach a palindrome. In base 10 it is unknown whether numbers exist that do not eventually reach a palindrome (196 is the smallest current candidate in base ten.)

In binary, however, there are numbers that never reach a palindrome. Find the smallest such number and prove it never reaches a palindrome.

No Solution Yet Submitted by Jer    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts there seems to be a pattern here | Comment 1 of 8
At n=22 in decimal there seems to be a pattern:

showing successive binary values, decimal equivalent and decimal equivalent of reversal:

10110 22 13
100011 35 49
1010100 84 21
1101001 105 75
10110100 180 45
11100001 225 135
101101000 360 45
110010101 405 339
1011101000 744 93
1101000101 837 651
10111010000 1488 93
11000101101 1581 1443
101111010000 3024 189
110010001101 3213 2835
1011110100000 6048 189
1100001011101 6237 5955
10111110100000 12192 381
11000100011101 12573 11811
101111101000000 24384 381
110000010111101 24765 24195
1011111101000000 48960 765
1100001000111101 49725 48195
10111111010000000 97920 765
11000000101111101 98685 97539
101111111010000000 196224 1533
110000010001111101 197757 194691
1011111110100000000 392448 1533
1100000001011111101 393981 391683
10111111110100000000 785664 3069
11000000100011111101 788733 782595
101111111101000000000 1571328 3069
110000000010111111101 1574397 1569795
1011111111101000000000 3144192 6141
1100000001000111111101 3150333 3138051
10111111111010000000000 6288384 6141
11000000000101111111101 6294525 6285315
101111111111010000000000 12579840 12285
110000000010001111111101 12592125 12567555
1011111111110100000000000 25159680 12285
1100000000001011111111101 25171965 25153539
10111111111110100000000000 50325504 24573
11000000000100011111111101 50350077 50300931
101111111111101000000000000 100651008 24573
110000000000010111111111101 100675581 100638723
1011111111111101000000000000 201314304 49149
1100000000001000111111111101 201363453 201265155
10111111111111010000000000000 402628608 49149
11000000000000101111111111101 402677757 402604035
101111111111111010000000000000 805281792 98301
110000000000010001111111111101 805380093 805183491
1011111111111110100000000000000 1610563584 98301
1100000000000001011111111111101 1610661885 1610514435
10111111111111110100000000000000 3221176320 196605
11000000000000100011111111111101 3221372925 3220979715
101111111111111101000000000000000 6442352640 196605
110000000000000010111111111111101 6442549245 6442254339
1011111111111111101000000000000000 12884803584 393213
1100000000000001000111111111111101 12885196797 12884410371
10111111111111111010000000000000000 25769607168 393213
11000000000000000101111111111111101 25770000381 25769410563
101111111111111111010000000000000000 51539410944 786429
110000000000000010001111111111111101 51540197373 51538624515
1011111111111111110100000000000000000 103078821888 786429
1100000000000000001011111111111111101 103079608317 103078428675
10111111111111111110100000000000000000 206158036992 1572861
11000000000000000100011111111111111101 206159609853 206156464131
101111111111111111101000000000000000000 412316073984 1572861
110000000000000000010111111111111111101 412317646845 412315287555
1011111111111111111101000000000000000000 824632934400 3145725
1100000000000000001000111111111111111101 824636080125 824629788675
10111111111111111111010000000000000000000 1649265868800 3145725
11000000000000000000101111111111111111101 1649269014525 1649264295939
101111111111111111111010000000000000000000 3298533310464 6291453
110000000000000000010001111111111111111101 3298539601917 3298527019011
1011111111111111111110100000000000000000000 6597066620928 6291453
1100000000000000000001011111111111111111101 6597072912381 6597063475203
10111111111111111111110100000000000000000000 13194136387584 12582909
11000000000000000000100011111111111111111101 13194148970493 13194123804675
101111111111111111111101000000000000000000000 26388272775168 12582909
110000000000000000000010111111111111111111101 26388285358077 26388266483715
1011111111111111111111101000000000000000000000 52776551841792 25165821
1100000000000000000001000111111111111111111101 52776577007613 52776526675971
10111111111111111111111010000000000000000000000 105553103683584 25165821
11000000000000000000000101111111111111111111101 105553128849405 105553091100675
101111111111111111111111010000000000000000000000 211106219950080 50331645
110000000000000000000010001111111111111111111101 211106270281725 211106169618435
1011111111111111111111110100000000000000000000000 422212439900160 50331645
1100000000000000000000001011111111111111111111101 422212490231805 422212414734339
10111111111111111111111110100000000000000000000000 844424904966144 100663293
11000000000000000000000100011111111111111111111101 844425005629437 844424804302851
101111111111111111111111101000000000000000000000000 1688849809932288 100663293
110000000000000000000000010111111111111111111111101 1688849910595581 1688849759600643
1011111111111111111111111101000000000000000000000000 3377699670196224 201326589
1100000000000000000000001000111111111111111111111101 3377699871522813 3377699468869635
10111111111111111111111111010000000000000000000000000 6755399340392448 201326589
11000000000000000000000000101111111111111111111111101 6755399541719037 6755399239729155
 
 22       10000
>> 

clc, clearvars
for n=2:999
  num=n; ct=0;
  while true
   b=dec2bin(num);
   b2=flip(b);
   if ct<100 && n==22
  %    disp([b ' ' b2 ' ' num2str(num) ' ' num2str(bin2dec(b2))]) 
      disp([b ' '   num2str(num) ' ' num2str(bin2dec(b2))])       
   end
   if isequal(b,b2)
       break
   end
   num=num+bin2dec(b2);
   
   ct=ct+1;
   if ct==10000
      disp([n ct]) 
      break
   end
  end
  if ct==10000
     break 
  end
end

  Posted by Charlie on 2021-04-29 07:45:10
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information