Dyadic floor power
DefinitionCollatzWork_FloorPowercollatz-work-import
For a natural number , define
For positive x this is the greatest power of two at most x. The natural-number convention has log2(0)=0, hence F(0)=1. This convention keeps the function total; product-bin theorems impose positive dyadic lower bounds.
Definition code
import Std import Init.Grind.Ordered.Module namespace CollatzWork def floorPower (x : Nat) : Nat := 2 ^ Nat.log2 x end CollatzWork
Source