Answer the question
In order to leave comments, you need to log in
Look at a simple problem, why not right?
On one site this problem is given
The set of integers belonging to the numerical segment [4668; 10414], which are divisible by 3 or 11 and are not divisible by 2, 13, 22, 33. Find the number of such numbers and the minimum of them. In your answer, write down two integers without spaces or other additional characters: first the number, then the minimum number.
9654671
a = 0
b = 4668
for i in range(4668, 10414+1):
if i % 3 == 0 or i % 11 == 0 and i % 13 != 0 and i % 22 != 0 and i % 33 != 0:
a = a + 1
b = i
print(a,b)
207710413
Answer the question
In order to leave comments, you need to log in
1. We missed the condition i % 2 != 0
2. We were looking for the maximum and not the minimum
3. The priority of the and, or operators was not correctly performed
l = []
for i in range(4668, 10414+1):
if (i % 3 == 0 or i % 11 == 0) and (i % 2 != 0 and i % 13 != 0 and i % 22 != 0 and i % 33 != 0):
l.append(i)
print(len(l), min(l))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question