plumial.core.P._P.f

_P.f()[source]

Calculate the f polynomial (GCD factor).

The f polynomial represents the greatest common divisor factor that appears in the relationship between the d-polynomial d and the k polynomial. It is computed as the GCD of d and k, with special handling for even/odd values of g.

Return type:

Union[Expr, int, float]

Returns:

f polynomial (symbolic) or its numerical evaluation

Mathematical Background:

f = gcd(d, k) where d is the d-polynomial and k is the k polynomial For even g: f is computed over the entire cycle For odd g: f is the simple GCD of d and k

Examples

>>> p = P(133)
>>> f_symbolic = p.f()  # Symbolic form
>>> collatz_p = P(133).encode(B.Collatz)
>>> f_numeric = collatz_p.f()  # Numerical evaluation