FiSGO.OrderSearch.candidate_from_power

candidate_from_power(max_power, prime)[source]

Given a positive integer ‘max_power’ and a prime number ‘prime’, the function calculates which is the largest number n such that prime^max_power divides n!. To do this, we consider the summation sequence s(m) of OrderSearch.powers_sequence, whose m-th term precisely gives the maximum power of ‘prime’ contained in (prime*m)!. Thus, if m is the smallest integer such that max_power < s(m), then n = prime*m - 1.

Parameters:
  • max_power (int) – A positive integer.

  • prime (int) – A prime number.

Return type:

int

Returns:

Largest positive integer n such that prime^max_power exactly divides n!.