How can I use conditionals in Mathematica to check for multiples of 3?

  • Topic: Mathematica 
  • Thread starter Thread starter Niles
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 2K views
Niles
Messages
1,834
Reaction score
0
Hi all

I'm am looking for a smart way to make the following conditional in Mathematica:

Code:
if[i == 3*{1,2,3,4,5,N}, ...]
,

ï.e. if the variable i is a multiple of 3 up to some integer N. How can I do this smartest in Mathematica?


Niles.
 
Physics news on Phys.org
Er, what are you asking?

How to make a conditional statement? Check the documentation for If. (Or the guide section on programming)

How to make a range of integers? Check the documentation for Table. (Or the guide section on lists and sequences)
 
Ok, my answers were both answered looking at the documentation. Thanks.