1 | test_approxratio = ->
|
2 | run_test [
|
3 | "approxratio(0.9054054)",
|
4 | "67/74",
|
5 |
|
6 | "approxratio(0.0102)",
|
7 | "1/98",
|
8 |
|
9 | "approxratio(0.518518)",
|
10 | "14/27",
|
11 |
|
12 | "approxratio(0.3333)",
|
13 | "1/3",
|
14 |
|
15 | "approxratio(0.5)",
|
16 | "1/2",
|
17 |
|
18 | "approxratio(3.14159)",
|
19 | "355/113",
|
20 |
|
21 | "approxratio(a*3.14)",
|
22 | "a*22/7",
|
23 |
|
24 | "approxratio(a*b)",
|
25 | "a*b",
|
26 |
|
27 | "approxratio((0.5*4)^(1/3))",
|
28 | "2^(1/3)",
|
29 |
|
30 | "approxratio(3.14)",
|
31 | "22/7",
|
32 |
|
33 | # see http://davidbau.com/archives/2010/03/14/the_mystery_of_355113.html
|
34 | "approxratio(3.14159)",
|
35 | "355/113",
|
36 |
|
37 | "approxratio(-3.14159)",
|
38 | "-355/113",
|
39 |
|
40 | "approxratio(0)",
|
41 | "0",
|
42 |
|
43 | "approxratio(0.0)",
|
44 | "0",
|
45 |
|
46 | "approxratio(2)",
|
47 | "2",
|
48 |
|
49 | "approxratio(2.0)",
|
50 | "2",
|
51 |
|
52 | # -------------------------------
|
53 | # checking some "long primes"
|
54 | # also called long period primes, or maximal period primes
|
55 | # i.e. those numbers whose reciprocal give
|
56 | # long repeating sequences
|
57 | # (long prime p gives repetition of p-1 digits).
|
58 | # big list here: https://oeis.org/A001913/b001913.txt
|
59 | # also see: https://oeis.org/A001913
|
60 | # -------------------------------
|
61 |
|
62 | # 1st long prime
|
63 | "approxratio(0.14)",
|
64 | "1/7",
|
65 |
|
66 | # 9th long prime, the biggest 2-digits long prime.
|
67 | # Often asked to
|
68 | # mental calculators to check their abilities.
|
69 | "approxratio(0.0103)",
|
70 | "1/97",
|
71 |
|
72 | # 60th long prime, the biggest 3-digits long prime.
|
73 | # Often asked to
|
74 | # mental calculators to check their abilities.
|
75 | "approxratio(0.001017)",
|
76 | "1/983",
|
77 |
|
78 | # 467th long prime, the biggest 4-digits long prime.
|
79 | "approxratio(0.00010033)",
|
80 | "1/9967",
|
81 |
|
82 | # 3617th long prime, the biggest 5-digits long prime.
|
83 | "approxratio(0.0000100011)",
|
84 | "1/99989",
|
85 |
|
86 | # 10000th long prime.
|
87 | "approxratio(0.00000323701)",
|
88 | "1/308927",
|
89 |
|
90 | ]
|
91 |
|