order
#order YouYou wrote:
if is_prime(divisor) and number % divisor == 0:
that is, if A and B:
.
But B
is typically false and is quickly computed.
Prefer if B and A:
stride
#stride RatherRather than
for divisor in range(int(number ** 0.5) + 1, 0, -1):
you might want to begin with an odd number and then use a stride of -2
.
You needn't special case for when number
is a power of two,
since the input clearly isn't.
sieve
#sieve ConsiderConsider sieving for the solution.
#order You wrote:
if is_prime(divisor) and number % divisor == 0:
that is, if A and B:
.
But B
is typically false and is quickly computed.
Prefer if B and A:
#stride Rather than
for divisor in range(int(number ** 0.5) + 1, 0, -1):
you might want to begin with an odd number and then use a stride of -2
.
You needn't special case for when number
is a power of two,
since the input clearly isn't.
#sieve Consider sieving for the solution.
order
You wrote:
if is_prime(divisor) and number % divisor == 0:
that is, if A and B:
.
But B
is typically false and is quickly computed.
Prefer if B and A:
stride
Rather than
for divisor in range(int(number ** 0.5) + 1, 0, -1):
you might want to begin with an odd number and then use a stride of -2
.
You needn't special case for when number
is a power of two,
since the input clearly isn't.
sieve
Consider sieving for the solution.
#order You wrote:
if is_prime(divisor) and number % divisor == 0:
that is, if A and B:
.
But B
is typically false and is quickly computed.
Prefer if B and A:
#stride Rather than
for divisor in range(int(number ** 0.5) + 1, 0, -1):
you might want to begin with an odd number and then use a stride of -2
.
You needn't special case for when number
is a power of two,
since the input clearly isn't.
#sieve Consider sieving for the solution.