project_euler.problem_131.sol1¶
Project Euler Problem 131: https://projecteuler.net/problem=131
There are some prime values, p, for which there exists a positive integer, n, such that the expression n^3 + n^2p is a perfect cube.
For example, when p = 19, 8^3 + 8^2 x 19 = 12^3.
What is perhaps most surprising is that for each prime with this property the value of n is unique, and there are only four such primes below one-hundred.
How many primes below one million have this remarkable property?
Functions¶
|
Determines whether number is prime |
|
Returns number of primes below max_prime with the property |
Module Contents¶
- project_euler.problem_131.sol1.is_prime(number: int) bool ¶
Determines whether number is prime
>>> is_prime(3) True
>>> is_prime(4) False
- project_euler.problem_131.sol1.solution(max_prime: int = 10**6) int ¶
Returns number of primes below max_prime with the property
>>> solution(100) 4