Each of A, B, C and D is a positive integer with the proviso that A ≤ B ≤ C ≤ D ≤ 20.

Determine the total number of quadruplets (A, B, C, D) such that A*B*C*D is divisible by 50.

I agree with Charlie's answer = 1570. I did essentially the same four loops, but instead of dividing by 50 (or using mod) I just tested that the last two digits of the six-digit product field were either "00" or "50" -- probably did not save even a microsecond. The loop constraints handle the concern that the "less than or equal" could create any quadruplet twice (and hence the concern for doublecounting). Obviously the same products appear many times, but their uniqueness is not at issue (as I interpret this).