 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Distinct Values Validation (Posted on 2014-10-16) Each of x, y and z is a nonnegative integer such that:

(i) x+y+z = 94, and:
(ii) H = 4x+10y+19z

How many distinct values of H is possible?

 No Solution Yet Submitted by K Sengupta No Rating Comments: ( Back to comment list | You must be logged in to post comments.) Better late than never. Computer solution Comment 8 of 8 | duplicating Charlie's result
The number of distinct solutions is 465
The smallest is 376
The largest is 1786
----
ans_list = []
for x in range(0,95):     # (x can be from 0 through 94 inclusive)
for y in range(0,95):
if 94-x-y >= 0:
z = 94-x-y
H = 4*x+10*y+19*z
if H not in ans_list:
ans_list.append(H)

print('The number of distinct solutions is',len(ans_list))
print('The smallest is',min(ans_list))
print('The largest is',max(ans_list))

 Posted by Larry on 2020-09-10 04:39:16 Please log in:

 Search: Search body:
Forums (2)