Find the sum of numbers from 1000 to 4000 that satisfy the condition that the sum of all factors of the number can be divisible by 3 and 7 at the same time

Find the sum of numbers from 1000 to 4000 that satisfy the condition that the sum of all factors of the number can be divisible by 3 and 7 at the same time

There are 721 such numbers, the sum of which is 1810606vb. The code is not strict: he = 0 for I = 1000 to 4000iysh = 1 for k = 2 to IIF I mod k = 0 theniysh = iysh + kend ifnextif iysh mod 21 = 0 thenhe = He + iend ifnextprint