I am new to Mathematica and I have no idea how to make a basic for loop work. I want to loop through the elements of a list: Range[45, 200]
. I want to select the elements (i) for which the following conditions holds: if i mod 3 and i mod 8 and i mod 12 == 1 and i mod 5 == 0 I want to print the element. How would I achieve this?
I want something like this:
for i in range(45, 201):
if i%3==1 and i%8==1 and i%12==1 and i%5==0:
print i
Of course in Mathematica language. Sorry if this is a dumb question but the Mathematica documentation is pretty hard to understand. Thanks.
For
did you try to use for your problem and where did you get stuck? $\endgroup$Select
andCases
. $\endgroup$For
,Range
, andIf
functions work together. I even managed to put a little program together using pure logic, but the output was wrong. $\endgroup$