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

Home > Logic
Look b4 U leap (Posted on 2020-10-02) Difficulty: 2 of 5
Find a solution to the equation:
29x + 30y + 31z = 366

Rem: x,y,z must be positive

See The Solution Submitted by Ady TZIDON    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
I jumped before I looked, and never leaped | Comment 3 of 8 |
I never thought of the relationship of the problem to days of the month until I read Charlie's post.
I actually looked after I leaped and started with a short Python program (see below) that found the two solutions:
(x,y,z) = (1,4,7) or (2,2,8)

But then I noticed that since 29, 30, and 31 are so close together, if x y and z must be positive integers then x+y+z must be 12.  And since the sum is 366 rather than 360, z must be 6 larger than x.
So if z = x+6, and y = 12-x-z, then y=12-x-(x+6) = 6-2x.

So to make a table of possible values:
x, y=6-2x, z=x+6
0   6     6
1   4     7
2   2     8
3   0     9
throw out the ones with zeros, and poof!  Done!  That was fast.

Formally proving the above.
29x + 30y + 31z = 366
30(x+y+z) - x + z = 366
x+y+z = 12
360 - x + z = 366
z = x+6

-----   Python program
n=13
for x in range(1,n):
    for y in range(1,n):
        for z in range(1,n):
            if 29*x + 30*y + 31*z == 366:
                print(x,y,z,29*x + 30*y + 31*z)
  Posted by Larry on 2020-10-03 10:34:46
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