MCPcopy Create free account

hub / github.com/TheAlgorithms/Python / functions

Functions3,909 in github.com/TheAlgorithms/Python

↓ 1 callersFunctionsolution
Returns the sum of the digits in the numerator of the max-th convergent of the continued fraction for e. >>> solution(9) 13 >>>
project_euler/problem_065/sol1.py:74
↓ 1 callersFunctionsolution
Return the number of right triangles OPQ that can be formed by two points P, Q which have both x- and y- coordinates between 0 and limit incl
project_euler/problem_091/sol1.py:40
↓ 1 callersFunctionsolution
Returns the value of the first triangle number to have over five hundred divisors. >>> solution() 76576500
project_euler/problem_012/sol1.py:41
↓ 1 callersFunctionsolution
Returns the value of the first triangle number to have over five hundred divisors. >>> solution() 76576500
project_euler/problem_012/sol2.py:46
↓ 1 callersFunctionsolution
>>> solution(1) 1 >>> solution(9) 14 >>> solution() 55374
project_euler/problem_078/sol1.py:22
↓ 1 callersFunctionsolution
Returns the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits. >>> solution() 142857
project_euler/problem_052/sol1.py:13
↓ 1 callersFunctionsolution
Runs the calculation for numbers <= `max_num`. >>> solution(10) 6 >>> solution(200000) 12496
project_euler/problem_095/sol1.py:134
↓ 1 callersFunctionsolution
Returns the maximum pandigital prime number of length n. If there are none, then it will return 0. >>> solution(2) 0 >>> sol
project_euler/problem_041/sol1.py:59
↓ 1 callersFunctionsolution
Return the solution to the problem
project_euler/problem_046/sol1.py:110
↓ 1 callersFunctionsolution
Returns the last 8 digits of the hyperexponentiation of base by height, i.e. the number base↑↑height: >>> solution(base=3, height=2)
project_euler/problem_188/sol1.py:45
↓ 1 callersFunctionsolution
Returns the solution of the problem >>> solution(2) 229399 >>> solution(3) 221311
project_euler/problem_051/sol1.py:78
↓ 1 callersFunctionsolution
Takes list of strings `matrix_str` to parse the matrix and calculates the max sum. >>> solution(["1 2", "3 4"]) 5 >>> solution(MATRI
project_euler/problem_345/sol1.py:95
↓ 1 callersFunctionsolution
Returns ∑ r_max for 3 <= a <= n as explained above >>> solution(10) 300 >>> solution(100) 330750 >>> solution(1000) 33308
project_euler/problem_120/sol1.py:18
↓ 1 callersFunctionsolution
Returns the least number for which the proportion of bouncy numbers is exactly 'percent' >>> solution(50) 538 >>> solution(9
project_euler/problem_112/sol1.py:55
↓ 1 callersFunctionsolution
Calculate the number of non-bouncy numbers less than a googol. >>> solution(6) 12951 >>> solution(10) 277032
project_euler/problem_113/sol1.py:63
↓ 1 callersFunctionsolution
Returns the difference between the sum of the squares of the first n natural numbers and the square of the sum. >>> solution(10) 264
project_euler/problem_006/sol1.py:20
↓ 1 callersFunctionsolution
Returns the difference between the sum of the squares of the first n natural numbers and the square of the sum. >>> solution(10) 264
project_euler/problem_006/sol2.py:20
↓ 1 callersFunctionsolution
Returns the difference between the sum of the squares of the first n natural numbers and the square of the sum. >>> solution(10) 264
project_euler/problem_006/sol4.py:20
↓ 1 callersFunctionsolution
Returns the difference between the sum of the squares of the first n natural numbers and the square of the sum. >>> solution(10) 264
project_euler/problem_006/sol3.py:22
↓ 1 callersFunctionsolution
Find the area of the grid which contains as close to two million rectangles as possible. >>> solution(20) 6 >>> solution(2000)
project_euler/problem_085/sol1.py:53
↓ 1 callersFunctionsolution
Iterate through every possible cube and sort the cube's digits in ascending order. Sorting maintains an ordering of the digits that allows
project_euler/problem_062/sol1.py:16
↓ 1 callersFunctionsolution
()
project_euler/problem_030/sol1.py:35
↓ 1 callersFunctionsolution
Returns the count of all lychrel numbers below limit. >>> solution(10000) 249 >>> solution(5000) 76 >>> solution(1000)
project_euler/problem_055/sol1.py:56
↓ 1 callersFunctionsolution
Returns number of primes below max_prime with the property >>> solution(100) 4
project_euler/problem_131/sol1.py:32
↓ 1 callersFunctionsolution
Return the number of different square laminae that can be formed using up to one million tiles. >>> solution(100) 41
project_euler/problem_173/sol1.py:17
↓ 1 callersFunctionsolution
Find the sum of the FITs of the BOPS. For each interpolating polynomial of order 1, 2, ... , 10, find the first x such that the value of the
project_euler/problem_101/sol1.py:191
↓ 1 callersFunctionsolution
Returns the number of possible prize strings for a particular number of days, using a simple recursive function with caching to speed it up.
project_euler/problem_191/sol1.py:89
↓ 1 callersFunctionsolution
Find m for which the proportion of perfect partitions to total partitions is lower than max_proportion >>> solution(1) > 5 True
project_euler/problem_207/sol1.py:63
↓ 1 callersFunctionsolution
Returns the first ten digits of the sum of the array elements from the file num.txt >>> solution() '5537376230'
project_euler/problem_013/sol1.py:12
↓ 1 callersFunctionsolution
Returns the closest numerator of the fraction immediately to the left of given fraction (numerator/denominator) from a list of reduced pr
project_euler/problem_071/sol1.py:22
↓ 1 callersFunctionsolution
Returns the number of letters used to write all numbers from 1 to n. where n is lower or equals to 1000. >>> solution(1000) 21124 >>>
project_euler/problem_017/sol1.py:19
↓ 1 callersFunctionsolution
Returns the number of different ways can n pence be made using any number of coins? >>> solution(500) 6295434 >>> solution(200) 7
project_euler/problem_031/sol1.py:48
↓ 1 callersFunctionsolution
Returns the number of different ways to make X pence using any number of coins. The solution is based on dynamic programming paradigm in a bottom-
project_euler/problem_031/sol2.py:35
↓ 1 callersFunctionsolution
Returns the last n digits of NUMBER. >>> solution() '8739992577' >>> solution(8) '39992577' >>> solution(1) '7'
project_euler/problem_097/sol1.py:13
↓ 1 callersFunctionsolution
Finds the value of n from 1 to max such that n/φ(n) produces a minimum. >>> solution(100) 21 >>> solution(10000) 4435
project_euler/problem_070/sol1.py:75
↓ 1 callersFunctionsolution
Define n count list and loop over delta, y to get the counts, then check which n has count == 1. >>> solution(3) 0 >>> solution(
project_euler/problem_136/sol1.py:31
↓ 1 callersFunctionsolution
Returns the number of distinct terms in the sequence generated by a^b for 2 <= a <= 100 and 2 <= b <= 100. >>> solution(100) 9183 >>>
project_euler/problem_029/sol1.py:19
↓ 1 callersFunctionsolution
Returns the sum of all the amicable numbers under n. >>> solution(10000) 31626 >>> solution(5000) 8442 >>> solution(1000) 504
project_euler/problem_021/sol1.py:30
↓ 1 callersFunctionsolution
Calculates the expected number of distinct colours >>> solution(10) '5.669644129' >>> solution(30) '6.985042712'
project_euler/problem_493/sol1.py:34
↓ 1 callersFunctionsolution
Returns the count of all n-digit numbers which are nth power >>> solution(10, 22) 49 >>> solution(0, 0) 0 >>> solution(
project_euler/problem_063/sol1.py:14
↓ 1 callersFunctionsolution
()
project_euler/problem_054/sol1.py:366
↓ 1 callersFunctionsolution
Finds the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital >>> solution()
project_euler/problem_032/sol32.py:40
↓ 1 callersFunctionsolution
Return the least value of n for which least_divisible_repunit(n) first exceeds limit. >>> solution(10) 17 >>> solution(100) 1
project_euler/problem_129/sol1.py:37
↓ 1 callersFunctionsolution
Returns the number of values of nCr, for 1 ≤ n ≤ 100, are greater than one-million >>> solution() 4075
project_euler/problem_053/sol1.py:27
↓ 1 callersFunctionsolution
>>> solution() 709
project_euler/problem_099/sol1.py:20
↓ 1 callersFunctionsolution
Returns the least value of n for which the remainder first exceeds 10^10. >>> solution(1e8) 2371 >>> solution(1e9) 7037
project_euler/problem_123/sol1.py:80
↓ 1 callersFunctionsolution
Returns the total of all the name scores in the file. >>> solution() 871198282
project_euler/problem_022/sol1.py:21
↓ 1 callersFunctionsolution
Returns the total of all the name scores in the file. >>> solution() 871198282
project_euler/problem_022/sol2.py:21
↓ 1 callersFunctionsolution
Returns the number under n that generates the longest sequence using the formula: n → n/2 (n is even) n → 3n + 1 (n is odd) >>> solut
project_euler/problem_014/sol1.py:22
↓ 1 callersFunctionsolution
Returns the number under n that generates the longest Collatz sequence. >>> solution(1000000) 837799 >>> solution(200) 171 >>> so
project_euler/problem_014/sol2.py:44
↓ 1 callersFunctionsolution
Return the solution of the problem. >>> solution() 296962999629
project_euler/problem_049/sol1.py:95
↓ 1 callersFunctionsolution
Returns the product of a,b,c which are Pythagorean Triplet that satisfies the following: 1. a < b < c 2. a**2 + b**2 = c**2
project_euler/problem_009/sol1.py:20
↓ 1 callersFunctionsolution
Return the product of a,b,c which are Pythagorean Triplet that satisfies the following: 1. a < b < c 2. a**2 + b**2 = c**2
project_euler/problem_009/sol2.py:20
↓ 1 callersFunctionsolution
Precomputing squares and checking if a^2 + b^2 is the square by set look-up. >>> solution(12) 60 >>> solution(36) 1620
project_euler/problem_009/sol4.py:36
↓ 1 callersFunctionsolution
Returns the product of a,b,c which are Pythagorean Triplet that satisfies the following: 1. a**2 + b**2 = c**2 2. a + b + c = 100
project_euler/problem_009/sol3.py:20
↓ 1 callersFunctionsolution
Returns the sum of the perimeters of all almost equilateral triangles with integral side lengths and area and whose perimeters do not exceed
project_euler/problem_094/sol1.py:16
↓ 1 callersFunctionsolution
Returns the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. >>> solution() '2783915460'
project_euler/problem_024/sol1.py:16
↓ 1 callersFunctionsolution
Returns the number of mondays that fall on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? >>> solution()
project_euler/problem_019/sol1.py:24
↓ 1 callersFunctionsolution
Finds the maximum total in a triangle as described by the problem statement above. >>> solution() 7273
project_euler/problem_067/sol1.py:18
↓ 1 callersFunctionsolution
Finds the maximum total in a triangle as described by the problem statement above. >>> solution() 7273
project_euler/problem_067/sol2.py:18
↓ 1 callersFunctionsolution
Return the number of values of L <= limit such that a wire of length L can be formmed into an integer sided right angle triangle in exactly o
project_euler/problem_075/sol1.py:34
↓ 1 callersFunctionsolution
The function returns the number of integers that end up being 89 in each chain. The function accepts a range number and the function checks a
project_euler/problem_092/sol1.py:83
↓ 1 callersFunctionsolution
Returns the number of ways can a row of the given length be tiled >>> solution(5) 15
project_euler/problem_117/sol1.py:32
↓ 1 callersFunctionsolution
Returns the sum of all the primes below n. >>> solution(1000) 76127 >>> solution(5000) 1548136 >>> solution(10000) 57363
project_euler/problem_010/sol1.py:51
↓ 1 callersFunctionsolution
Returns the sum of all the primes below n. >>> solution(1000) 76127 >>> solution(5000) 1548136 >>> solution(10000) 57363
project_euler/problem_010/sol2.py:65
↓ 1 callersFunctionsolution
Returns the sum of all the primes below n using Sieve of Eratosthenes: The sieve of Eratosthenes is one of the most efficient ways to find a
project_euler/problem_010/sol3.py:16
↓ 1 callersFunctionsolution
Computes the solution to the problem up to the specified limit >>> solution(1000) 34825 >>> solution(10_000) 1134942 >>> so
project_euler/problem_234/sol1.py:53
↓ 1 callersFunctionsolution
Find the maximum prize fund that should be allocated to a single game in which fifteen turns are played. >>> solution(4) 10 >>> s
project_euler/problem_121/sol1.py:29
↓ 1 callersFunctionsolution
Returns an integer, the solution to the problem >>> solution(10) 31 >>> solution(100) 3043 >>> solution(1_000) 304191
project_euler/problem_072/sol1.py:27
↓ 1 callersFunctionsolution
Return the number of reduced proper fractions with denominator less than limit. >>> solution(8) 21 >>> solution(1000) 304191
project_euler/problem_072/sol2.py:20
↓ 1 callersFunctionsolution
Find the number of triangles whose interior contains the origin. >>> solution("test_triangles.txt") 1
project_euler/problem_102/sol1.py:60
↓ 1 callersFunctionsolution
Return the first value of the first four consecutive integers to have four distinct prime factors each. >>> solution() 134043
project_euler/problem_047/sol1.py:101
↓ 1 callersFunctionsolution
Returns the largest palindrome made from the product of two 3-digit numbers which is less than n. >>> solution(20000) 19591 >>>
project_euler/problem_004/sol1.py:16
↓ 1 callersFunctionsolution
Returns the largest palindrome made from the product of two 3-digit numbers which is less than n. >>> solution(20000) 19591 >>>
project_euler/problem_004/sol2.py:16
↓ 1 callersFunctionsolution
Return the largest 1 to 9 pandigital 9-digital number that can be formed as the concatenated product of an integer with (1,2,...,n) where n >
project_euler/problem_038/sol1.py:58
↓ 1 callersFunctionsolution
Returns the number of different ways can the grey tiles in a row of the given length be replaced if colours cannot be mixed and at least
project_euler/problem_116/sol1.py:38
↓ 1 callersFunctionsolution
Outputs the answer is the least Fibonacci number pandigital from both sides. >>> solution() 329468
project_euler/problem_104/sol1.py:102
↓ 1 callersFunctionsolution
Returns the largest prime factor of a given number n. >>> solution(13195) 29 >>> solution(10) 5 >>> solution(17) 17
project_euler/problem_003/sol1.py:51
↓ 1 callersFunctionsolution
Returns the largest prime factor of a given number n. >>> solution(13195) 29 >>> solution(10) 5 >>> solution(17) 17
project_euler/problem_003/sol2.py:15
↓ 1 callersFunctionsolution
Returns the largest prime factor of a given number n. >>> solution(13195) 29 >>> solution(10) 5 >>> solution(17) 17
project_euler/problem_003/sol3.py:15
↓ 1 callersFunctionsolution
Returns the count of numbers <= 10000 with odd periods. This function calls continuous_fraction_period for numbers which are not perfect
project_euler/problem_064/sol1.py:47
↓ 1 callersFunctionsolution
Returns the biggest prime, below the celing, that can be written as the sum of consecutive the most consecutive primes. >>> solution(500
project_euler/problem_050/sol1.py:54
↓ 1 callersFunctionsolution
Find the sum of the numerator and denominator of the sum of all s(x,y,z) for golden triples (x,y,z) of the given order. >>> solution(5)
project_euler/problem_180/sol1.py:88
↓ 1 callersFunctionsolution
>>> solution(1000, 1000) -59231 >>> solution(200, 1000) -59231 >>> solution(200, 200) -4925 >>> solution(-1000, 1000)
project_euler/problem_027/sol1.py:62
↓ 1 callersFunctionsolution
Returns the number of hybrid-integers less than or equal to base^degree >>> solution(800, 1) 2 >>> solution(800, 800) 10790
project_euler/problem_800/sol1.py:33
↓ 1 callersFunctionsolution
Find the maximum number for a "magic" gon_side-gon ring The gon_side parameter should be in the range [3, 5], other side numbers aren't
project_euler/problem_068/sol1.py:46
↓ 1 callersFunctionsolution
Returns solution to problem. Algorithm: 1. Precompute φ(k) for all natural k, k <= n using product formula (wikilink below) https://e
project_euler/problem_069/sol1.py:27
↓ 1 callersFunctionsolution
Returns the number of composite integers below max_number have precisely two, not necessarily distinct, prime factors. >>> solution(30)
project_euler/problem_187/sol1.py:117
↓ 1 callersFunctionsolution
Returns the sum of all pandigital numbers which pass the divisibility tests. >>> solution(10) 16695334890
project_euler/problem_043/sol1.py:51
↓ 1 callersFunctionsolution
Count the number of distinct ways a player can checkout with a score less than limit. >>> solution(171) 42336 >>> solution(50)
project_euler/problem_109/sol1.py:59
↓ 1 callersFunctionsolution
Returns the shortest possible secret passcode of unknown length for successful login attempts given by `input_file` text file. >>> solut
project_euler/problem_079/sol1.py:56
↓ 1 callersFunctionsolution
Find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. >>> solutio
project_euler/problem_107/sol1.py:95
↓ 1 callersFunctionsolution
Return the number of integers less than limit which can be expressed as the sum of a prime square, prime cube, and prime fourth power. >>
project_euler/problem_087/sol1.py:18
↓ 1 callersFunctionsolution
To evaluate the sum, Used decimal python module to calculate the decimal places up to 100, the most important thing would be take calculate
project_euler/problem_080/sol1.py:13
↓ 1 callersFunctionsolution
Return the sum of all numbers, less than n , which are palindromic in base 10 and base 2. >>> solution(1000000) 872187 >>> solution(5
project_euler/problem_036/sol1.py:39
↓ 1 callersFunctionsolution
Returns the greatest product of four adjacent numbers (horizontally, vertically, or diagonally). >>> solution() 70600674
project_euler/problem_011/sol1.py:71
↓ 1 callersFunctionsolution
Returns the greatest product of four adjacent numbers (horizontally, vertically, or diagonally). >>> solution() 70600674
project_euler/problem_011/sol2.py:30
↓ 1 callersFunctionsolution
Finds the maximum total in a triangle as described by the problem statement above. >>> solution() 1074
project_euler/problem_018/solution.py:34
↓ 1 callersFunctionsolution
Return the number of times that the beam hits the interior wall of the cell before exiting. >>> solution(0.00001,-10) 1 >>> solut
project_euler/problem_144/sol1.py:78
↓ 1 callersFunctionsolution
Return the least value of M such that there are more than one million cuboids of side lengths 1 <= a,b,c <= M such that the shortest distance
project_euler/problem_086/sol1.py:72
← previousnext →2,001–2,100 of 3,909, ranked by callers