FiSGO.OrderSearch.powers_sequence

powers_sequence(prime, n)[source]

The function returns the exponent corresponding to the maximum power of ‘prime’ that divides prime*n. Rather than calculating prime*n and computing PrimesHandler.contained_power(prime*n, prime), this is done recursively.

Example: If prime = 3, then the sequence is [1,1,2,1,1,2,1,1,3,1,…] where each entry corresponds to the power of 3 contained in [3,6,9,12,15,18,21,24,27,30,…].

Caution

We index the sequence starting at n=1.

Parameters:
  • prime (int) – A prime number.

  • n (int) – A positive integer.

Return type:

int

Returns:

The n-th term of the described sequence.