def isPrime(n):
# Corner case
if (n <= 1):
return False
# Check from 2 to sqrt(n)
for i in range(2, int(n**.5)+1):
if (n % i == 0):
return False
return True
def gap(distance, range_lower, range_upper):
worked_area = list(range(range_lower,range_upper+1))
find_primes = [el for el in worked_area if isPrime(el)]
if len(find_primes) == 0:
return []
for i in range(1, len(find_primes)):
if find_primes[i] - find_primes[i-1] == distance:
return [find_primes[i-1], find_primes[i]]
return []
def isPrime(n):
# Corner case
if (n <= 1):
return False
# Check from 2 to sqrt(n)
for i in range(2, int(n**.5)+1):
if (n % i == 0):
return False
return True
def gap(g, m, n):
start = 0
end = 0
for i in range(m,n+1):
if isPrime(i):
if start == 0:
start = i
elif end == 0:
end = i
else:
start = end
end = i
if end - start == g:
return [start, end]
return None
from aiomysql import Pool, DictCursor
from basa.db import db_pool
class dbsql():
pool: Pool = db_pool
async def register(self):
async with self.pool.acquire() as conn:
async with conn.cursor() as cur:
result = await cur.execute("SELECT * FROM profile WHERE uid")
row = await cur.fetchall()
if result == 0:
await cur.execute(f'INSERT INTO profile(uid) VALUES(uid)')
else:
return await row
main = dbsql()
import requests
url = "https://series.naver.com/comic/recentList.series?page="
pagination_last_index = 1
while True:
r1 = requests.get(url + str(pagination_last_index))
r2 = requests.get(url + str(pagination_last_index + 1))
if r1.text == r2.text:
print(pagination_last_index)
break
pagination_last_index += 1