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

Home > Just Math
Stopping for lunch II (Posted on 2012-09-28) Difficulty: 3 of 5
This is a generalization of Stopping for lunch

Abe and Ben are on a road trip, and stop at a roadside picnic table for lunch. Abe has P sandwiches. Bert has Q sandwiches. Cal comes along and asks if they would share the sandwiches between the three of them. And they did, each got (P+Q)/3 sandwiches. When Cal is finished he leaves P+Q dollars to pay for the sandwiches.

Abe and Ben thereafter divide the money according to the ratio of the sandwiches each of them gave to Cal.
(For example, if (P, Q) = (5, 3), then Abe gives 5-8/3=7/3 sandwiches and, Ben gives 3 -8/3=1/3 sandwiches to Cal. Therefore, the 8 dollars which has been contributed by Cal should be divided in the ratio 7:1, so that Abe receives 7 dollars and, Ben receives 1 dollar.)

It is observed that Abe’s share of the money is precisely R times that of Ben.

Given that each of P, Q and R is a positive integer with Q < P < 2Q:

(i) Express P in terms of Q whenever, gcd(P, Q) = 1 and R = 1 (mod 3)

(ii) If (P, R) =(Q+m, m+1), then determine Q in terms of m.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Hints/Tips computer exploration Comment 1 of 1

DECLARE FUNCTION gcd# (a#, b#)
DEFDBL A-Z
CLS
FOR tot = 3 TO 100
  FOR q = -INT(-tot / 3) TO INT(tot / 2)
    p = tot - q
    IF p > q AND p < 2 * q THEN
      dollars = p + q
      abegave = p - (p + q) / 3
      bengave = q - (p + q) / 3
      r = abegave / bengave
      rr = INT(r + .5)
      IF ABS(rr - r) < .000001# THEN
        r = rr
        IF gcd(p, q) = 1 AND r MOD 3 = 1 THEN
          PRINT p; q,
          PRINT USING "#####.####"; abegave; bengave;
          PRINT r,
          PRINT USING "####.##"; (p + q) * r / (r + 1); (p + q) / (r + 1); dollars
        END IF
      END IF
    END IF
  NEXT q
NEXT tot

STOP
PRINT

FOR tot = 3 TO 100
  FOR q = -INT(-tot / 3) TO INT(tot / 2)
    p = tot - q
    IF p > q AND p < 2 * q THEN
      dollars = p + q
      abegave = p - (p + q) / 3
      bengave = q - (p + q) / 3
      r = abegave / bengave
      rr = INT(r + .5)
      m = p - q
      r = rr
      IF r = m + 1 THEN
          PRINT p; q; m,
          PRINT USING "#####.####"; abegave; bengave;
          PRINT r,
          PRINT USING "####.##"; (p + q) * r / (r + 1); (p + q) / (r + 1); dollars
      END IF
    END IF
  NEXT q
NEXT tot

FUNCTION gcd (a, b)
 x = a: y = b
 DO
  q = INT(x / y)
  r = x - y * q
  x = y: y = r
 LOOP UNTIL r = 0
 gcd = x
END FUNCTION

finds

for part (i):
                   Abe       Ben            Abe's  Ben's  Total
 p   q             gave      Gave   r       share  share  Dollars
 3  2             1.3333    0.3333 4         4.00   1.00   5.00
 5  3             2.3333    0.3333 7         7.00   1.00   8.00
 7  4             3.3333    0.3333 10       10.00   1.00  11.00
 9  5             4.3333    0.3333 13       13.00   1.00  14.00
 11  6            5.3333    0.3333 16       16.00   1.00  17.00
 13  7            6.3333    0.3333 19       19.00   1.00  20.00
 15  8            7.3333    0.3333 22       22.00   1.00  23.00
 17  9            8.3333    0.3333 25       25.00   1.00  26.00
 19  10           9.3333    0.3333 28       28.00   1.00  29.00
 21  11          10.3333    0.3333 31       31.00   1.00  32.00
 23  12          11.3333    0.3333 34       34.00   1.00  35.00
 25  13          12.3333    0.3333 37       37.00   1.00  38.00
 27  14          13.3333    0.3333 40       40.00   1.00  41.00
 29  15          14.3333    0.3333 43       43.00   1.00  44.00
 31  16          15.3333    0.3333 46       46.00   1.00  47.00
 33  17          16.3333    0.3333 49       49.00   1.00  50.00
 35  18          17.3333    0.3333 52       52.00   1.00  53.00
 37  19          18.3333    0.3333 55       55.00   1.00  56.00
 39  20          19.3333    0.3333 58       58.00   1.00  59.00
 41  21          20.3333    0.3333 61       61.00   1.00  62.00
 43  22          21.3333    0.3333 64       64.00   1.00  65.00
 45  23          22.3333    0.3333 67       67.00   1.00  68.00
 47  24          23.3333    0.3333 70       70.00   1.00  71.00
 49  25          24.3333    0.3333 73       73.00   1.00  74.00
 51  26          25.3333    0.3333 76       76.00   1.00  77.00
 53  27          26.3333    0.3333 79       79.00   1.00  80.00
 55  28          27.3333    0.3333 82       82.00   1.00  83.00
 57  29          28.3333    0.3333 85       85.00   1.00  86.00
 59  30          29.3333    0.3333 88       88.00   1.00  89.00
 61  31          30.3333    0.3333 91       91.00   1.00  92.00
 63  32          31.3333    0.3333 94       94.00   1.00  95.00
 65  33          32.3333    0.3333 97       97.00   1.00  98.00

 
where p = 2*q - 1 in these instances.

for part (ii)

                   Abe       Ben            Abe's  Ben's  Total
 p   q  m          gave      Gave   r       share  share  Dollars
 5  4  1          2.0000    1.0000 2         6.00   3.00   9.00
 6  5  1          2.3333    1.3333 2         7.33   3.67  11.00
 7  5  2          3.0000    1.0000 3         9.00   3.00  12.00
 7  6  1          2.6667    1.6667 2         8.67   4.33  13.00
 8  6  2          3.3333    1.3333 3        10.50   3.50  14.00
 9  6  3          4.0000    1.0000 4        12.00   3.00  15.00
 8  7  1          3.0000    2.0000 2        10.00   5.00  15.00
 11  7  4         5.0000    1.0000 5        15.00   3.00  18.00
 13  8  5         6.0000    1.0000 6        18.00   3.00  21.00
 15  9  6         7.0000    1.0000 7        21.00   3.00  24.00
 17  10  7        8.0000    1.0000 8        24.00   3.00  27.00
 19  11  8        9.0000    1.0000 9        27.00   3.00  30.00
 21  12  9       10.0000    1.0000 10       30.00   3.00  33.00
 23  13  10      11.0000    1.0000 11       33.00   3.00  36.00
 25  14  11      12.0000    1.0000 12       36.00   3.00  39.00
 27  15  12      13.0000    1.0000 13       39.00   3.00  42.00
 29  16  13      14.0000    1.0000 14       42.00   3.00  45.00
 31  17  14      15.0000    1.0000 15       45.00   3.00  48.00
 33  18  15      16.0000    1.0000 16       48.00   3.00  51.00
 35  19  16      17.0000    1.0000 17       51.00   3.00  54.00
 37  20  17      18.0000    1.0000 18       54.00   3.00  57.00
 39  21  18      19.0000    1.0000 19       57.00   3.00  60.00
 41  22  19      20.0000    1.0000 20       60.00   3.00  63.00
 43  23  20      21.0000    1.0000 21       63.00   3.00  66.00
 45  24  21      22.0000    1.0000 22       66.00   3.00  69.00
 47  25  22      23.0000    1.0000 23       69.00   3.00  72.00
 49  26  23      24.0000    1.0000 24       72.00   3.00  75.00
 51  27  24      25.0000    1.0000 25       75.00   3.00  78.00
 53  28  25      26.0000    1.0000 26       78.00   3.00  81.00
 55  29  26      27.0000    1.0000 27       81.00   3.00  84.00
 57  30  27      28.0000    1.0000 28       84.00   3.00  87.00
 59  31  28      29.0000    1.0000 29       87.00   3.00  90.00
 61  32  29      30.0000    1.0000 30       90.00   3.00  93.00
 63  33  30      31.0000    1.0000 31       93.00   3.00  96.00
 65  34  31      32.0000    1.0000 32       96.00   3.00  99.00

 
In most of these instances, Q = m + 3.

However, for some (P,Q), this is not the case. Two of these cases, (6,5) and (7,6) involve dollar amounts that do not exactly follow the agreed-upon division of dollars as the cents to not come out even.

But the case of (P,Q) = (8,7) also has a Q that's not 3 more than m, as Q = m + 6, even though this instance isn't unusual in other respects.


  Posted by Charlie on 2012-09-28 23:44:25
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 (10)
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