https://www.geecoders.com/2021/07/how to create-loop-in-swi-prolog.html