Skip to content

Instantly share code, notes, and snippets.

@Aleksey-Danchin
Last active July 23, 2025 08:22
Show Gist options
  • Save Aleksey-Danchin/9e9762fc7a09d5b324175d45ee9dbfec to your computer and use it in GitHub Desktop.
Save Aleksey-Danchin/9e9762fc7a09d5b324175d45ee9dbfec to your computer and use it in GitHub Desktop.
Контрпример диагонального метода Кантора
numbers = []
k = 3
x = 0.4142135623730950488 # 2**0.5 - 1
for i in range(1, k):
j = 10**i
n = 1 / j
c = x * j
c = c - int(c)
c = c / j
a = 0
while True:
b = round(c + round(a, i), 7)
if b >= 1:
break
if b not in numbers:
numbers.append(b)
a += n
for i in range(len(numbers)):
print(i+1, ': ', numbers[i], '...', sep="")
1: 0.0142136...
2: 0.1142136...
3: 0.2142136...
4: 0.3142136...
5: 0.4142136...
6: 0.5142136...
7: 0.6142136...
8: 0.7142136...
9: 0.8142136...
10: 0.9142136...
11: 0.0042136...
12: 0.0242136...
13: 0.0342136...
14: 0.0442136...
15: 0.0542136...
16: 0.0642136...
17: 0.0742136...
18: 0.0842136...
19: 0.0942136...
20: 0.1042136...
21: 0.1242136...
22: 0.1342136...
23: 0.1442136...
24: 0.1542136...
25: 0.1642136...
26: 0.1742136...
27: 0.1842136...
28: 0.1942136...
29: 0.2042136...
30: 0.2242136...
31: 0.2342136...
32: 0.2442136...
33: 0.2542136...
34: 0.2642136...
35: 0.2742136...
36: 0.2842136...
37: 0.2942136...
38: 0.3042136...
39: 0.3242136...
40: 0.3342136...
41: 0.3442136...
42: 0.3542136...
43: 0.3642136...
44: 0.3742136...
45: 0.3842136...
46: 0.3942136...
47: 0.4042136...
48: 0.4242136...
49: 0.4342136...
50: 0.4442136...
51: 0.4542136...
52: 0.4642136...
53: 0.4742136...
54: 0.4842136...
55: 0.4942136...
56: 0.5042136...
57: 0.5242136...
58: 0.5342136...
59: 0.5442136...
60: 0.5542136...
61: 0.5642136...
62: 0.5742136...
63: 0.5842136...
64: 0.5942136...
65: 0.6042136...
66: 0.6242136...
67: 0.6342136...
68: 0.6442136...
69: 0.6542136...
70: 0.6642136...
71: 0.6742136...
72: 0.6842136...
73: 0.6942136...
74: 0.7042136...
75: 0.7242136...
76: 0.7342136...
77: 0.7442136...
78: 0.7542136...
79: 0.7642136...
80: 0.7742136...
81: 0.7842136...
82: 0.7942136...
83: 0.8042136...
84: 0.8242136...
85: 0.8342136...
86: 0.8442136...
87: 0.8542136...
88: 0.8642136...
89: 0.8742136...
90: 0.8842136...
91: 0.8942136...
92: 0.9042136...
93: 0.9242136...
94: 0.9342136...
95: 0.9442136...
96: 0.9542136...
97: 0.9642136...
98: 0.9742136...
99: 0.9842136...
100: 0.9942136...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment