A while ago, I had a look at the prime factorization of 27000:
27000 = 23 × 33 × 53
There are two special things about that:
- consecutive-prime: The primes are consecutive: 2 is the 1st prime, 3 is the 2nd prime, 5 is the 3rd prime.
- constant-exponent: The exponent is the same for every prime (always 3)
An integer x is a consecutive-prime/constant-exponent number if there exist strictly positive integers n, k, m such that x = pnm × pn+1m × ... × pn+km, where pj is the j-th prime
Your task is to test if a positive integer fulfills these conditions.
A positive integer > 1, in any reasonable form.
One of two values, at least one of which has to be constant, indicating whether the input is a consecutive-prime/constant-exponent number.
- primes are truthy, as the factorization for prime p is p1
- other numbers that can be written as pm where p is a prime are also truthy.
- Standard loopholes apply.
- No worries about integer overflow, but numbers up to 255 must work.
- Shortest code in bytes wins.
2 3 4 5 6 7 8 9 11 13 15 27000 456533
10 12 14 72 10000000
Here is a python script generating some test cases.