Definition primesGI (x : GI) :=
[seq i <- [seq GI_of_ord i| i : ordinalGI ('N x).+1] |
primeGI i && (i %| x)].

Lemma pdivGI_leq x : x != 0 -> ('N (pdivGI x) <= 'N x)%N.
Fixpoint logGI_rec p x n :=
if (p %| x) then
if n is n1.+1 then (logGI_rec p (x %/ p) n1).+1 else 0%N
else 0%N.