Problem
You've stumbled upon a paradoxical mathematical phenomenon related to prime numbers. Consider the following scenario:
You have an infinite list of prime numbers: $$2, 3, 5, 7, 11, 13, 17, 19, ...$$
Now, you decide to pair up these prime numbers in a way that each prime is paired with its consecutive prime number and generate fractions by dividing the smaller number of each pair by the larger number. And you start adding them... $$\frac{2}{3}+\frac{3}{5}+\frac{5}{7}+\frac{7}{11}+\frac{11}{13}+\frac{13}{17}...$$ they seem to be converging!!!??? Your task is to calculate the sum of all fractions in this sequence.
Write a program or function that calculates the sum of these fractions up to a specified number of pairs (n).
Input:
- An integer
nrepresenting the number of prime pairs to consider (1 ≤n≤ 1000).
Output
- A floating-point number or The accurate fraction representing the sum of the fractions.
Examples
$$n = 3$$ $$\frac{2}{3}+\frac{3}{5}+\frac{5}{7}=1.980952$$
Smallest code wins (bytes)
Some test cases
3 = 1.980952 (208/105) 7 = 5.122912 (24845332/4849845) 9 = 6.742102 (21809669044/3234846615) 185 = 179.189745 564 = 556.886274 849 = 841.414962 999 = 991.228537