factor out functions to scan for start codes
gcd and simplify for urational type