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

Home > Just Math
Distinct Values Validation (Posted on 2014-10-16) Difficulty: 3 of 5
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?

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 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:
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 (19)
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