Constraint to repeat a number at every third time

In reply to Etrx91:

Thanks for the detailed code it helped.