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

Home > Numbers
Aleph0 (Posted on 2024-05-20) Difficulty: 3 of 5
All rational numbers can be put into a 1-to-1 matching with the integers. For the positive of each, the below table shows a 1-to-1 matching where the rationals are laid out in order of the total of the numerator and denominator of the number expressed as a fraction in simplest (reduced) form. Within one total of numerator and denominator, they are in order of the numerator.

    1     1              1/14    64
  1/2     2              2/13    65
    2     3              4/11    66
  1/3     4               7/8    67
    3     5               8/7    68
  1/4     6              11/4    69
  2/3     7              13/2    70
  3/2     8                14    71
    4     9              1/15    72
  1/5    10              3/13    73
    5    11              5/11    74
  1/6    12               7/9    75
  2/5    13               9/7    76
  3/4    14              11/5    77
  4/3    15              13/3    78
  5/2    16                15    79
    6    17              1/16    80
  1/7    18              2/15    81
  3/5    19              3/14    82
  5/3    20              4/13    83
    7    21              5/12    84
  1/8    22              6/11    85
  2/7    23              7/10    86
  4/5    24               8/9    87
  5/4    25               9/8    88
  7/2    26              10/7    89
    8    27              11/6    90
  1/9    28              12/5    91
  3/7    29              13/4    92
  7/3    30              14/3    93
    9    31              15/2    94
 1/10    32                16    95
  2/9    33              1/17    96
  3/8    34              5/13    97
  4/7    35              7/11    98
  5/6    36              11/7    99
  6/5    37              13/5   100
  7/4    38                17   101
  8/3    39              1/18   102
  9/2    40              2/17   103
   10    41              3/16   104
 1/11    42              4/15   105
  5/7    43              5/14   106
  7/5    44              6/13   107
   11    45              7/12   108
 1/12    46              8/11   109
 2/11    47              9/10   110
 3/10    48              10/9   111
  4/9    49              11/8   112
  5/8    50              12/7   113
  6/7    51              13/6   114
  7/6    52              14/5   115
  8/5    53              15/4   116
  9/4    54              16/3   117
 10/3    55              17/2   118
 11/2    56                18   119
   12    57              1/19   120
 1/13    58              3/17   121
 3/11    59              7/13   122
  5/9    60              9/11   123
  9/5    61              11/9   124
 11/3    62              13/7   125
   13    63              17/3   126
                           19   127

Using this scheme, what rational number is matched to the integer 1 million?

When 1 million is considered as a rational number, to what integer is it matched?

See The Solution Submitted by Charlie    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Part 1 Comment 4 of 4 |
Part 1:
I wrote a program to match the list in the statement of the problem.  Since Python lists are zero-based, the "zero-th" element is a blank.  
Here are first 10 elements, 0 through 9:
alist[:10]
['', '1/1', '1/2', '2/1', '1/3', '3/1', '1/4', '2/3', '3/2', '4/1']
What rational number is matched to the integer 1 million?

alist[1000000] =  '113/1701'  (whose n + d sum is 1814)
------   ------
import math
count = 0
alist = ['']
finished = False
for asum in range(2,1000003):
    for p in range(1,asum):
        q = asum - p
        if math.gcd(p,q) != 1:
            continue
        alist.append(str(p) + '/' + str(q))
        if len(alist) == 1000001:
            print('alist[1000000] = ', alist[1000000])
            finished = True
            break
    if finished:
        break

Part 2:  I rewrote the code in order to find the answer to part 2.
All I had to do was run the program a lot farther looking for:
alist.index('1000000/1')     (whose n + d sum is 1000001)

But my computer ran out of memory and choked.
But I have some intermediate results.  First the modified code:

count = 0
a_dict = {}
asum = 2
while asum < 1000005:
    for p in range(1,asum):
        q = asum - p
        if math.gcd(p,q) != 1:
            continue
        count += 1
        if q == 1 and str(p)[-4:] == '0000':
            a_dict[str(p) + '/' + str(q)] = count
            print(p,count)
    asum += 1

Intermediate results where p is the numerator (and the denominator is 1):
p     integer
10000 30407277
20000 121603387
30000 273600177
40000 486380275
50000 759952823
60000 1094335409
70000 1489495819
80000 1945453481
90000 2462193829
100000 3039741653
110000 3678059147
120000 4377196945
130000 5137116825
140000 5957809263
150000 6839354027


Edited on May 20, 2024, 8:25 pm
  Posted by Larry on 2024-05-20 20:09:47

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