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

 Point to 2013 (2) (Posted on 2013-02-22)
Each of p and q is a positive integer with gcd(p, q)=1.

Determine the minimum value of p+q such that:
• The first four digits immediately following the decimal point in the base ten expansion of p/q + q/p is 2013.

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 2

The answer is 169 as found below:

DECLARE FUNCTION gcd# (a#, b#)
DEFDBL A-Z
CLS
FOR t = 3 TO 99999
FOR p = 1 TO t / 2
q = t - p
v\$ = STR\$(p / q + q / p)
ix = INSTR(v\$, ".")
IF ix > 0 AND gcd(p, q) = 1 THEN
IF MID\$(v\$, ix + 1, 4) = "2013" THEN
PRINT USING "#### #### ####.##########   #####"; p; q; VAL(v\$); t
ct = ct + 1
END IF
END IF
NEXT
IF ct > 40 THEN END
NEXT

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

finds the 41 lowest p+q satisfying the criterion:

`    p   and        p/q + q/p       p+q    q  66  103    2.2013827596     169  28  169    6.2013947591     197  87  248    3.2013811643     335  77  304    4.2013414217     381 157  245    2.2013258807     402  67  473    7.2013505412     540 223  348    2.2013427143     571  11  563   51.2013563701     574  25  604   24.2013907285     629 248  387    2.2013107444     635  17  683   40.2013607786     700 289  451    2.2013518594     740  32  709   22.2013839915     741 194  553    3.2013292071     747 339  529    2.2013037344     868 355  554    2.2013576041     909 380  593    2.2013357593     973 405  632    2.2013166120    1037 212  837    4.2013987512    1049 116  937    8.2013855666    1053 421  657    2.2013615477    1078 281  801    3.2013452935    1082 301  858    3.2013141897    1159  16 1155   72.2013528139    1171 129 1042    8.2013197637    1171 487  760    2.2013644223    1247 512  799    2.2013478763    1311 101 1224   12.2013282211    1325 537  838    2.2013328711    1375 127 1283   10.2013489545    1410 553  863    2.2013666109    1416 368 1049    3.2013537738    1417 289 1141    4.2013834765    1430 562  877    2.2013192013    1439 569  888    2.2013984547    1457 587  916    2.2013066960    1503 603  941    2.2013383314    1544 408 1163    3.2013070490    1571 619  966    2.2013683327    1585 327 1291    4.2013042541    1618 635  991    2.2013968234    1626`

Edited on February 22, 2013, 2:07 pm
 Posted by Charlie on 2013-02-22 14:06:08

 Search: Search body:
Forums (0)