-
Notifications
You must be signed in to change notification settings - Fork 0
/
A357676.py
56 lines (50 loc) · 972 Bytes
/
A357676.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
#! /usr/bin/env python3
from labmath import *
def A357477_0(n): # Smallest k such that sqrt(kn) rounds to a prime
for k in count(1):
if isprime(round(sqrt(k*n))):
return k
def A357477_1(n): # A357477 without floating points
for kn in count(n, n):
x = isqrt(kn)
if kn > x*x + x: x += 1
if isprime(x): return kn // n
A357477 = A357477_1
record, index, counter = 0, 0, 0
batch = 10**6
for n in count(1):
if n % batch == 0: print('\b'*42, n, end='', flush=True)
a = A357477(n)
if a > record:
record, index = a, n
counter += 1
print('\b'*42 + "%d %d " % (counter, index))
"""
1 1
2 19
3 67
4 154
5 218
6 251
7 601
8 651
9 652
10 7051
11 17001
12 101157
13 555039
14 971160
15 1240273
16 6191735
17 81174469
18 84349567
19 131625552
20 214344967
21 214345119
22 3974507614
23 5446707884
24 5574291825
25 41016920663
26 69752538433
Any subsequent terms are > 10^11.
"""