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

Home > Numbers
Square Rearranger (Posted on 2023-12-06) Difficulty: 3 of 5
Find the smallest three distinct whole numbers A, B and C such that you can rearrange the digits of A and B to get C^2, the digits of A and C to get B^2, and the digits of B and C to get A^2.

**** Leading zeroes are not allowed.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
better algorithm and answer again | Comment 5 of 26 |
I improved the algorithm. The 5 digit case takes 3 hr instead of 
25 hours. The program is here and new algorithm is: 

A, B, C are called i, j, k. The "inv" means the inventory; the 
of the number of: 0's, 1's, ..., 9's in the number 
"&" means combine the digits into a long list. 
We explore i < j < k with loops:

step 1 - find SOD(i & j)
step 2 -  use list of SOD(squares) to find k
step 3 -  if (k.le.j) loop
step 4 -  find SOD(i & k)
step 5 -  if SOD(i&K) .ne. SOD(j^2) loop
step 6 -  find SOD(j & k)
step 7 -  if SOD(j&K) .ne. SOD(i^2) loop
step 8 -  if .not. inv(i)+inv(j)=inv(k^2) loop
step 9 -  if .not. inv(i)+inv(k)=inv(j^2) loop
step 10- if .not. inv(j)+inv(k)=inv(i^2) loop
To get here we did not loop, so we have an answer! 
loop for more i, j, k

The first found solution below is the answer: 
i.e., the smallest...

lord@rabbit 13382 % loo5a
cpu time =  3.3 min, A = 41800 out of 99999
cpu time =  4.3 min, A = 41900 out of 99999
cpu time =  5.3 min, A = 42000 out of 99999

 --------- A, B, C, C^2, Inventory(C^2)
42005 50042 74162 5500002244
0:4  1:0  2:2  3:0  4:2  5:2  6:0  7:0  8:0  9:0

 --------- A, B, C, C^2, Inventory(C^2)
42005 50420 74162 5500002244
0:4  1:0  2:2  3:0  4:2  5:2  6:0  7:0  8:0  9:0
cpu time =  6.3 min, A = 42100 out of 99999

cpu time =  7.3 min, A = 42200 out of 99999
cpu time =  8.3 min, A = 42300 out of 99999
.
.
.
cpu time =  0.8 min, A = 48500 out of 99999
cpu time =  1.6 min, A = 48600 out of 99999

 --------- A, B, C, C^2, Inventory(C^2)
48681 63126 93879 8813266641
0:0  1:2  2:1  3:1  4:1  5:0  6:3  7:0  8:2  9:0
cpu time =  0.6 min, A = 49900 out of 99999
cpu time =  1.2 min, A = 50000 out of 99999
.
.
.
 --------- A, B, C, C^2, Inventory(C^2)
50042 50420 74162 5500002244
0:4  1:0  2:2  3:0  4:2  5:2  6:0  7:0  8:0  9:0
cpu time =  2.0 min, A = 50100 out of 99999

cpu time between steps goes as (99999-i); when we get 

near 99999 there are fewer j and k's to check.   


There are no solutions for the 1,2,3 and 4 digit A, B, Cs.

All four 5 digit solutions are listed above, including the smallest.

6-digit solutions can be made from 10 x 5-digit solutions. 

Edited on December 24, 2023, 12:27 am
  Posted by Steven Lord on 2023-12-21 13:35:24

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 (3)
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