-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgpt3_solution.py
More file actions
25 lines (22 loc) · 849 Bytes
/
Copy pathgpt3_solution.py
File metadata and controls
25 lines (22 loc) · 849 Bytes
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
import json
import time
# START - CODE GENERATED BY gpt3
def solution():
max_pandigital = 0
for i in range(1, 10000):
concatenated_product = ""
n = 1
while len(concatenated_product) < 9:
concatenated_product += str(i * n)
n += 1
if len(concatenated_product) == 9 and len(set(concatenated_product)) == 9 and "0" not in concatenated_product:
pandigital = int(concatenated_product)
if pandigital > max_pandigital:
max_pandigital = pandigital
return max_pandigital
# END - CODE GENERATED BY gpt3
cpu_s, wall_s = time.process_time(), time.time()
result = solution()
cpu_e, wall_e = time.process_time(), time.time()
cpu_time, wall_time = cpu_e - cpu_s, wall_e - wall_s
print(json.dumps({"solution": result, "cpu": cpu_time, "wall": wall_time}))