gen_nproduct(500, 6) # Example with n=500, p=6
gen_nproduct(700, 4) # Example with n=700, p=4
gen_nproduct(625, 4) # Example with n=625 (perfect power)
gen_nproduct(30, 3) # Example with n=30, p=3
gen_nproduct(7, 2) # Example where exact product might be hard
Run the code above in your browser using DataLab