expected 2 blank lines, found 1
1from functools import reduce
2
3def main():4 return sum(list(int(j) for j in str(reduce(lambda x, y: x*y, range(1, 101)))))
5
6print(main())
expected 2 blank lines, found 0
1from funcs import listPrimes
2def main():3
4 return sum(listPrimes(int(2e6)))
5print(main())
expected 2 blank lines, found 0
1from math import prod
2def main():3 n = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"
4
5 return max(prod(list(int(c) for c in n[i:i+13])) for i in range(len(n)-13+1))
expected 2 blank lines, found 1
1from funcs import nthPrime
2
3def main():4 return nthPrime(10001)
5
6print(main())
expected 2 blank lines, found 1
1from math import gcd, prod
2
3def main():4 count = 1
5 for i in range(1, 21):
6 count *= i // gcd(i, count)
expected 2 blank lines, found 1
1from funcs import isPalendromic
2
3def main(): 4 # shorthand for
5 # palendromes = []
6 # for i in range(100, 1000):
expected 2 blank lines, found 1
1from funcs import smallestPrimeFactor
2
3def main(): 4 x = 600851475143
5 while True:
6 y = smallestPrimeFactor(x)
expected 2 blank lines, found 1
1from funcs import isPrime
2
3def main(): 4 # previous fibonacci number, current fibonacci number
5 x, y = 1, 2
6 total = 0
expected 2 blank lines, found 1
11 pfile.write(soup.prettify())
12 DOWNLOADED = True_
13
14def downloadAll():15 for i in range(1, 773):
16 res = requests.get(f"https://projecteuler.net/problem={i}")
17 with open(f"html/p{str(i).zfill(3)}.html", "w", encoding="utf-8") as pfile:
expected 2 blank lines, found 0
3from numpy import True_
4import requests
5import bs4 as BeautifulSoup
6def downloadMinimal(): 7 for i in range(1, 773):
8 res = requests.get(f"https://projecteuler.net/minimal={i}")
9 with open(f"html/p{str(i).zfill(3)}-MINIMAL.html", "w", encoding="utf-8") as pfile:
expected 2 blank lines, found 1
5import itertools
6from functools import reduce
7
8def distance(points:list): 9 """
10 Checks the distance between two points on a graph
11 Parameters:
expected 2 blank lines, found 1
120 return i
121 return n
122
123def to_exponential(n, decimals_num:int=2) -> str:124 b = decimal.Decimal(str(decimal.Decimal(str(n)).copy_abs()))
125 j = decimal.Decimal(math.floor(math.floor(b.log10())/3))
126 h = round(decimal.Decimal(str(n))/10**(j*3), decimals_num)
expected 2 blank lines, found 1
114 """
115 return math.floor(nthRoot(n, 2))
116
117def smallestPrimeFactor(n) -> int:118 for i in range(2, fsqrt(n) + 1):
119 if n % i == 0:
120 return i
expected 2 blank lines, found 1
104 """
105 return num**(1./root)
106
107def fsqrt(n) -> int:108 """
109 Get the floored square root of a number (`n`)
110 Parameters:
expected 2 blank lines, found 1
89def listPrimes(n):
90 return [i for (i, isprime) in enumerate(listPrimality(n)) if isprime]
91
92def nthPrime(n): 93 return next(itertools.islice(filter(isPrime, itertools.count(2)), n-1, None))
94
95
expected 2 blank lines, found 1
73
74# Returns a list of True and False indicating whether each number is prime.
75# For 0 <= i <= n, result[i] is True if i is a prime number, False otherwise.
76def listPrimality(n): 77 # Sieve of Eratosthenes
78 result = [True] * (n + 1)
79 result[0] = result[1] = False
expected 2 blank lines, found 1
50 """
51 return list(str(n))==list(reversed(list(str(n))))
52
53def isPandigital(n, until=9): 54 """
55 Checks whether a number is pandigital from 0 to `until` (contains each number from 0 to `until` in it's digits)
56
expected 2 blank lines, found 1
38 """
39 return set(f for i in range(1, int(n**0.5)+1) if n % i == 0 for f in [i, n//i])
40
41def isPalendromic(n): 42 """
43 Checks whether a number is a palindrome (same backwards and forwards)
44
expected 2 blank lines, found 1
27 """
28 return all(n % i != 0 for i in range(int(n**0.5)+1)[2:])
29
30def factors(n): 31 """
32 Lists the factors of a number
33
expected 2 blank lines, found 1
15 """
16 return math.sqrt((points[1][1] - points[0][1])**2 + (points[1][0] - points[0][0])**2)
17
18def isPrime(n): 19 """
20 Checks primality on a number
21
Description
Two blank lines are expected between functions and classes.