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

Home > Logic
Professor and Students (Posted on 2003-04-28) Difficulty: 4 of 5
A Professor asked four students how long each of them had been studying.

One of the students replied: “We have all been studying a whole number of years, the sum of our years of studying is equal to the number of years you have been teaching and the product of our years of studying is 180”.

“I’m sorry”, replied the Professor after some thought, “but that doesn’t give me enough information”.

“Yes, you’re right”, agrees another of the students. “But if we told you that one of us were into double figures in our years of study, then you could surely answer your question”.

How long had each of the four been studying ?

See The Solution Submitted by Ravi Raja    
Rating: 3.4000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: solution | Comment 2 of 14 |
(In reply to solution by Charlie)

The list of ways to factor 180 into 4 factors was produced from sorting the output of the following program by total:
DECLARE SUB factorit (n!, lev!)
DIM SHARED fact(4)
n = 180
OPEN "factors.txt" FOR OUTPUT AS #1
factorit n, 1
CLOSE
END

SUB factorit (n, lev)
  IF lev = 1 THEN strt = 1: ELSE strt = fact(lev - 1)
  IF lev = 4 THEN
    IF strt <= n AND n >= fact(lev - 1) THEN
      strt = n:
    ELSE
      EXIT SUB
    END IF
  END IF
  FOR i = strt TO n
    IF n \ i = n / i THEN
      fact(lev) = i
      IF lev = 4 THEN
       tot = 0
       FOR j = 1 TO 4
        PRINT #1, USING "###"; fact(j);
        IF j < 4 THEN PRINT #1, "+"; : ELSE PRINT #1, "=";
        tot = tot + fact(j)
       NEXT
       PRINT #1, tot
      ELSE
       factorit n / i, lev + 1
      END IF
    END IF
  NEXT
END SUB


  Posted by Charlie on 2003-04-28 03:59:00

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 (5)
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