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

Home > Numbers
Integer Diagonal (Posted on 2023-10-18) Difficulty: 3 of 5
Find a rectangular prism whose edges and main diagonal have integer lengths, such that the squares of the edges are 10-digit pandigital numbers.

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

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution | Comment 2 of 4 |
I'm assuming this is a box and the main diagonal is from one corner to the opposite corner.
I'm also assuming that the edge lengths are not necessarily distinct.

Let the edge lengths be integers a,b,c s.t. each of these when squared forms a pandigital 10-digit integer.  Also √(a^2 + b^2 + c^2) must be an integer

There are only 87 10-digit pandigitals which are perfect squares.
Their square roots are the possible values for edge lengths.
Searching a combination of those 87 values taken 3 at a time (I used combinations with replacement since there is no requirement that the 3 different edge lengths be distinct), I looked for integer diagonal values.

I found only one solution, which in fact, did have 2 of the lengths equal

side 1  side 2  side 3  diagonal
45624 91248 91248 136872.0

The squares of each side is indeed a 10-digit pandigital:
2081549376  8326197504  8326197504

Check, since diagonal calc used an "epsilon" method:
    45624^2 + 91248^2 + 91248^2 = 18733944384
    136872^2 = 18733944384

------------
def intdiag(a,b,c):
    epsilon = .0000001
    diag = (a**2 + b**2 + c**2)**.5
    if abs(diag - round(diag)) < epsilon:
        return True
    return False

def issquare(n):
    """ Input an integer, Returns True iff it is a perfect square. """
    if round(n**0.5)**2 == n:
        return True
    else:
        return False
    
edgeworthies = []

from itertools import permutations
from itertools import combinations_with_replacement

for p in permutations('0123456789'):
    if p[0] == '0':
        continue
    n = int(''.join(p))
    if issquare(n):
        edgeworthies.append(int(round(n**.5)))

for comb in combinations_with_replacement(edgeworthies,3):
    a = comb[0]
    b = comb[1]
    c = comb[2]
    if intdiag(a,b,c):
        diag = (a**2 + b**2 + c**2)**.5
        print(a,b,c,diag)

  Posted by Larry on 2023-10-18 14:18:16
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