added nested detect loops to pythagorean post