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

Home > Just Math
Another 2006 Problem (Posted on 2006-09-30) Difficulty: 2 of 5
Determine the total number of positive integer solutions of:

2/x + 3/y = 1/2006

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.)
re: A Computer Assisted look ??? | Comment 7 of 9 |
(In reply to A Computer Assisted look ??? by brianjn)

This is a precision problem. Instead of float you should have used double. In the first example you give, x=99068, y=6272, the LHS = 621354488 and the RHS does equal the 621354496 you show, but these are close enough to count as equal for single precision floating point. (LONG for long integers would also probably work, as you are working with integers; and if you exceed the limits of that type, the program would bomb with an overflow rather than give misleading results.)

The following program uses xdog's factorization to list the 72 solutions:

DEFDBL A-Z
OPEN "anot2006.txt" FOR OUTPUT AS #2
FOR p2 = 0 TO 3
FOR p3 = 0 TO 1
FOR p17 = 0 TO 2
FOR p59 = 0 TO 2
 f1 = INT(2 ^ p2 * 3 ^ p3 * 17 ^ p17 * 59 ^ p59 + .5)
 f2 = 24144216 / f1
 IF f2 <> INT(f2) THEN
      REM
 END IF
 x = f1 + 2 * 2006
 y = f2 + 3 * 2006
 IF x > 0 AND y > 0 THEN
   GOSUB report
 END IF
 x = 2 * 2006 - f1
 y = 3 * 2006 - f2
 IF x > 0 AND y > 0 THEN
   GOSUB report
 END IF
NEXT
NEXT
NEXT
NEXT


PRINT ct, big
END

report:
  PRINT #2, USING "#########"; x; y
  PRINT USING "#########"; x; y
  ct = ct + 1
  IF x > big THEN big = x
  IF y > big THEN big = y
RETURN

Note that it also checks to see if there are solutions that have two negative factors that lead to positive x and y; it didn't find any.

The output file, sorted externally to the program, shows the 72 solutions for x and y:

     4013 24150234
     4014 12078126
     4015  8054090
     4016  6042072
     4018  4030054
     4020  3024045
     4024  2018036
     4029  1426266
     4036  1012027
     4046   716142
     4063   479434
     4071   415242
     4080   361080
     4114   242726
     4130   210630
     4148   183549
     4189   142426
     4216   124372
     4248   108324
     4301    89562
     4366    74222
     4420    65195
     4484    57171
     4590    47790
     4720    40120
     4879    33866
     5015    30090
     5168    26904
     5428    23069
     5746    19942
     6018    18054
     6324    16461
     7021    14042
     7480    12980
     7493    12954
     8024    12036
    10030    10030
    10948     9499
    10974     9486
    12036     9027
    14455     8330
    16048     8024
    17936     7752
    21063     7434
    24898     7174
    28084     7021
    31860     6885
    38114     6726
    45784     6596
    55165     6490
    63189     6426
    72216     6372
    87556     6307
   106318     6254
   122366     6222
   140420     6195
   181543     6154
   208624     6136
   240720     6120
   359074     6086
   413236     6077
   477428     6069
   714136     6052
  1010021     6042
  1424260     6035
  2016030     6030
  3022039     6026
  4028048     6024
  6040066     6022
  8052084     6021
 12076120     6020
 24148228     6019

  Posted by Charlie on 2006-10-01 10:17:41
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 (23)
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