If the sequence a lists the Higgs primes, then
is the smallest prime greater than
such that
divides the product
. The first four Higgs primes are 2, 3, 5, and 7. Therefore, the next one is 11 because 11-1 = 10 divides
.
Write a function to determine whether a number is a Higgs prime.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers7
Suggested Problems
-
Determine Whether an array is empty
819 Solvers
-
Given a window, how many subsets of a vector sum positive
873 Solvers
-
Create logical matrix with a specific row and column sums
353 Solvers
-
Find the definite integral of various linear functions
62 Solvers
-
Factorial: Unlimited Size : java.math
49 Solvers
More from this Author329
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Well, here is the Python function to check whether a number is higgs prime or not.
def is_higgs_prime(number):
# List of the first four Higgs primes
higgs_primes = [2, 3, 5, 7]
# Check if the number is less than 11 or not a prime number
if number <= 7 or not is_prime(number):
return False
# Check if (number - 1) divides the product of the first four Higgs primes
product = 2 * 3 * 5 * 7
return (number - 1) % product == 0
def is_prime(n):
if n <= 1:
return False
elif n <= 3:
return True
elif n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True
# Example usage:
number_to_check = 11
if is_higgs_prime(number_to_check):
print(f"{number_to_check} is a Higgs prime.")
else:
print(f"{number_to_check} is not a Higgs prime.")
Thanks
@Gulshan have you tried that Python solution with the numbers from the test suite?