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

Home > Numbers
5-Digit Squares (Posted on 2009-12-06) Difficulty: 3 of 5

No Solution Yet Submitted by brianjn    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution | Comment 1 of 5
Well, somehow I managed to remember the site after 2 years of inactivity, and decided to start wasting some homework time here, again.

First off, I decided to find the maximum value of A by determining when A+(A+1) was as close to 100,000 as possible without going over. That gets us a range of A's to check from 100 to 223.

We check B over the range A+1 to √(100000-A).

To check all possible values for A, B, and C, I used the following code in Python.

def five_digit_squares():
    cdu=check_digits_used
    for val_a in range(100,224):
        for val_b in range(val_a+1,int((100000-val_a**2)**.5)):
            works=1
            val_c=int((val_a**2+val_b**2+0.00000001)**.5)
            if val_c**2==(val_a**2+val_b**2) and val_c<=316:
                works=cdu(val_a**2)*cdu(val_b**2)*cdu(val_c**2)
                if works==1:
                    used=[]
                str_digits=str(val_a**2)+str(val_b**2)+str(val_c**2)
                    for digit in range(0,15):
                        if used.count(str_digits[digit])==0:
                            works=works+1
                            used=used+[str_digits[digit]]
                    if works==11:
                        print(val_a,val_b,val_c)



This ends up getting us a solution of 136 273 305. So, A is 136, B is 273, and C is 305.

136=1 8 4 9 6
273=7 4 5 2 9
305=9 3 0 2 5

Edited on December 6, 2009, 9:39 pm
  Posted by Justin on 2009-12-06 21:34:31

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 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information