Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Created February 3, 2017 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/d37e5398d08aff3c1dc38d348e00a52a to your computer and use it in GitHub Desktop.
Save hyuki0000/d37e5398d08aff3c1dc38d348e00a52a to your computer and use it in GitHub Desktop.
Making A Babylonian-like Reciprocal Table (1..100)
# Making A Babylonian-like Reciprocal Table (1..100)
# 1..100 の逆数表をバビロニア風に作る
# ただし、無限小数になるものは ... を付加する
# https://cakes.mu/posts/15267
def inv60(n)
a = []
m = 1
loop do
x = (60 * m) / n
m = 60 * m - x * n
if a.include?(x)
a << '...'
break
end
a << x
break if m == 0
end
puts "#{n} #{a.join(',')}"
end
(1..100).each do |n|
inv60(n)
end
@hyuki0000
Copy link
Author

1 60
2 30
3 20
4 15
5 12
6 10
7 8,34,17,...
8 7,30
9 6,40
10 6
11 5,27,16,21,49,...
12 5
13 4,36,55,23,...
14 4,17,8,34,...
15 4
16 3,45
17 3,31,45,52,56,28,14,7,...
18 3,20
19 3,9,28,25,15,47,22,6,18,56,50,31,34,44,12,37,53,41,...
20 3
21 2,51,25,42,...
22 2,43,38,10,54,32,...
23 2,36,31,18,15,39,7,49,33,54,46,57,23,28,41,44,20,52,10,26,5,13,...
24 2,30
25 2,24
26 2,18,27,41,32,...
27 2,13,20
28 2,8,34,17,...
29 2,4,8,16,33,6,12,24,49,39,18,37,14,28,57,55,51,43,26,53,47,35,10,20,41,22,45,31,...
30 2
31 1,56,7,44,30,58,3,52,15,29,...
32 1,52,30
33 1,49,5,27,16,21,...
34 1,45,52,56,28,14,7,3,31,...
35 1,42,51,25,...
36 1,40
37 1,37,17,50,16,12,58,22,42,9,43,47,...
38 1,34,44,12,37,53,41,3,9,28,25,15,47,22,6,18,56,50,31,...
39 1,32,18,27,41,...
40 1,30
41 1,27,48,17,33,39,30,43,54,8,46,49,45,21,57,4,23,24,52,40,58,32,11,42,26,20,29,16,5,51,13,10,14,38,2,55,36,35,7,19,...
42 1,25,42,51,...
43 1,23,43,15,20,55,48,50,13,57,12,33,29,18,8,22,19,32,5,34,53,...
44 1,21,49,5,27,16,...
45 1,20
46 1,18,15,39,7,49,33,54,46,57,23,28,41,44,20,52,10,26,5,13,2,36,31,...
47 1,16,35,44,40,51,3,49,47,14,2,33,11,29,21,42,7,39,34,28,5,6,22,58,43,24,15,19,8,56,10,12,45,57,26,48,30,38,17,52,20,25,31,54,53,37,...
48 1,15
49 1,13,28,9,47,45,18,22,2,26,56,19,35,30,36,44,4,53,52,39,11,...
50 1,12
51 1,10,35,17,38,49,24,42,21,...
52 1,9,13,50,46,...
53 1,7,55,28,18,6,47,32,49,48,40,45,16,58,52,4,31,41,53,12,27,10,11,19,14,43,...
54 1,6,40
55 1,5,27,16,21,49,...
56 1,4,17,8,34,...
57 1,3,9,28,25,15,47,22,6,18,56,50,31,34,44,12,37,53,41,...
58 1,2,4,8,16,33,6,12,24,49,39,18,37,14,28,57,55,51,43,26,53,47,35,10,20,41,22,45,31,...
59 1,...
60 1
61 0,59,...
62 0,58,3,52,15,29,1,56,7,44,30,...
63 0,57,8,34,17,...
64 0,56,15
65 0,55,23,4,36,...
66 0,54,32,43,38,10,...
67 0,53,43,52,50,8,57,18,48,21,29,33,...
68 0,52,56,28,14,7,3,31,45,...
69 0,52,10,26,5,13,2,36,31,18,15,39,7,49,33,54,46,57,23,28,41,44,20,...
70 0,51,25,42,...
71 0,50,42,15,12,40,33,48,10,8,27,2,32,6,45,38,1,41,24,30,25,21,7,36,20,16,54,5,4,13,31,...
72 0,50
73 0,49,18,54,14,47,40,16,26,...
74 0,48,38,55,8,6,29,11,21,4,51,53,30,...
75 0,48
76 0,47,22,6,18,56,50,31,34,44,12,37,53,41,3,9,28,25,15,...
77 0,46,45,11,41,17,55,19,28,49,52,12,...
78 0,46,9,13,50,...
79 0,45,34,10,37,58,28,51,38,44,3,2,16,42,31,53,55,26,...
80 0,45
81 0,44,26,40
82 0,43,54,8,46,49,45,21,57,4,23,24,52,40,58,32,11,42,26,20,29,16,5,51,13,10,14,38,2,55,36,35,7,19,1,27,48,17,33,39,30,...
83 0,43,22,24,34,41,55,39,45,32,31,48,26,1,...
84 0,42,51,25,...
85 0,42,21,10,35,17,38,49,24,...
86 0,41,51,37,40,27,54,25,6,58,36,16,44,39,4,11,9,46,2,47,26,30,...
87 0,41,22,45,31,2,4,8,16,33,6,12,24,49,39,18,37,14,28,57,55,51,43,26,53,47,35,10,20,...
88 0,40,54,32,43,38,10,...
89 0,40,26,57,58,39,6,4,2,41,47,51,54,36,24,16,10,...
90 0,40
91 0,39,33,37,34,56,42,11,52,5,16,29,...
92 0,39,7,49,33,54,46,57,23,28,41,44,20,52,10,26,5,13,2,36,31,18,15,...
93 0,38,42,34,50,19,21,17,25,9,40,...
94 0,38,17,52,20,25,31,54,53,37,1,16,35,44,40,51,3,49,47,14,2,33,11,29,21,42,7,39,34,28,5,6,22,58,43,24,15,19,8,56,10,12,45,57,26,48,30,...
95 0,37,53,41,3,9,28,25,15,47,22,6,18,56,50,31,34,44,12,...
96 0,37,30
97 0,37,6,48,14,50,43,17,56,...
98 0,36,44,4,53,52,39,11,1,13,28,9,47,45,18,22,2,26,56,19,35,30,...
99 0,36,21,49,5,27,16,...
100 0,36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment