This repository has been archived by the owner on Nov 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestmean.py
82 lines (56 loc) · 1.56 KB
/
testmean.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python
import sys
import fileinput
import numpy as np
P = 115792089237316195423570985008687907853269984665640564039457584007908834671663
N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
# skip = int("00000000000000000000000000000000000000000000000000000027eb78574a",16)
skip = 0
def hexify(i):
return hex(i).replace("0x", "").replace("L", "").zfill(64)
data = []
for line in fileinput.input():
line = line.replace("0x", "").replace("L", "").replace("\n", "")
try:
i = int(line, 16)
if i > 0:
data.append(i)
except:
pass
import random
random.shuffle(data)
start = 0
end = len(data) - 1
mid = int(end / 2)
def prepare(data):
data2 = [data[k] for k in range(mid, end)]
data2.extend(data[k] for k in range(mid, start, -1))
return data2
def invert(data):
return [data[k] for k in range(start, end)]
# data = prepare(data)
# data = invert(data)
# print end, mid
# print np.mean(data)
def AM(data):
accum = sum(data[i] for i in range(0, len(data) - 1))
return accum / len(data)
def GM(data):
accum = 1
for i in range(0, len(data) - 1):
accum *= data[i]
return accum ** (1 / len(data))
def HM(data):
accum = sum(1 / data[i] for i in range(0, len(data) - 1))
return len(data) * (accum**-1)
# print hex(AM(data))
# print HM(data)
m = AM(data)
# for i in range(0,len(data)-1):
# print hexify((m*data[i]) % N )
# print hexify((m-data[i]) % N )
# print hexify((m+data[i]) % N )
j = N
while True:
j -= m
print(hexify(j % N))