Basically all my Project Euler relevant codes, mainly in Python. I have put all the current necessary resources on the "resources" folder.
You can also do Project Euler+ by HackerRank here.
- check_primes
is_prime
, checks whether a positive integer is a prime numberis_composite
, the exact opposite ofis_prime
sieve
, returns a list of all prime numbers up to the input integer
- check_sequences
is_triangle
, checks whether an integer is in the formn(n+1)/2
is_square
, checks whether an integer is in the formn**2
is_pentagonal
, checks whether an integer is in the formn(3n-1)/2
is_hexagonal
, checks whether an integer is in the formn(2n-1)
is_heptagonal
, checks whether an integer is in the formn(5n-3)/2
is_octagonal
, checks whether an integer is in the formn(3n-2)
- choose
binom
, takes two integersn
andr
, returningnCr
- number_theory
gcd
, takes two integer inputs and returns the GCD of both integerslcm
, takes two integer inputs and returns the LCM of both integersfactorial
, returns the factorial of the integer inputfactor
, returns the number of positive factors of the input integersum_factor
, returns the sum of all positive factors of the input integerfib
, returns the n-th Fibonacci number, where n is the inputcongruence
, takes three integer inputs a, b, m and solves for x where ax = b mod m
- palindromes
is_palindromic
, checks whether an integer or string-ized integer is a palindrome
Some problems are solved using sequences (lists, tuples, dictionaries, etc) which is computationally more expensive compared to assigning and modifying a constant number of variables. This is because it was done a very long time ago. For now, I've only decided to improve some, especially the first problems. Maybe more in the future.