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

  • Thread starter Thread starter Niles
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
The discussion centers on creating a conditional statement in Mathematica to check if a variable 'i' is a multiple of 3 up to a specified integer 'N'. The initial query seeks a smart way to express this condition. Responses suggest consulting Mathematica's documentation for the 'If' function to create conditional statements and the 'Table' function for generating ranges of integers. The user acknowledges that their questions were resolved by reviewing the documentation.
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.
 

Similar threads

Back
Top