-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path023.py
62 lines (42 loc) · 1.03 KB
/
023.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# !/usr/bin/python3
# -*- coding: utf-8 -*-
print(f'----------------------23--')
excess_numbers = []
def sum_divider(n): # ДЕЛИТЕЛИ
i = 1
res = 0
tmp = n / 2 + 1
while i < tmp:
if n % i == 0:
res += i
i += 1
return res
def perfect_number(n):
return True if n == sum_divider(n) else False
def arr_index(n):
try:
excess_numbers.index(n)
except ValueError:
return False
else:
return True
print(perfect_number(28))
print(arr_index(0))
ress = 0
# for i in range(28100, 11111111111):
for i in range(1, 28130):
# for i in range(1, 33):
found = False
for j in range(0, len(excess_numbers)):
tmp = i - excess_numbers[j]
# print(tmp)
if tmp in excess_numbers:
print(i, '(', excess_numbers[j], '+', excess_numbers[excess_numbers.index(tmp)], ')')
found = True
break
else:
pass
if found == False:
ress += i
print(i, '>', ress)
print('>>', ress)