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

 Even and Odd Products (Posted on 2023-08-07)
Find two different 5-digit numbers, each containing 5 different even digits, whose product is a square.

Do the same for odd digits.

 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.)
 Computer Solution Comment 1 of 1
46208 * 64082 = 2961101056 = 54416^2
19375 * 57319 = 1110555625 = 33325^2

--------------
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

odddigits = '13579'
evendigits = '24680'
odds = []
evens = []
from itertools import permutations
from itertools import combinations

for perm in permutations(odddigits):
p = ''.join(perm)
odds.append(int(p))
for perm in permutations(evendigits):
if perm[0] == '0':
continue
p = ''.join(perm)
evens.append(int(p))

for comb in combinations(evens,2):
a = comb[0]
b = comb[1]
if issquare(a*b) :
print('{} * {} = {} = {}^2'.format(a,b,a*b,int((a*b)**.5)))

for comb in combinations(odds,2):
a = comb[0]
b = comb[1]
if issquare(a*b) :
print('{} * {} = {} = {}^2'.format(a,b,a*b,int((a*b)**.5)))

 Posted by Larry on 2023-08-07 08:16:51

 Search: Search body:
Forums (2)