3D Prime Factorization (Layered)