Fix segmented euler_phi
Some more speedups