1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Series of sorts- Return 1 or 2 based on even or odd n

  1. Mar 5, 2013 #1
    I would like to create a series where for each term if n is odd the term =1 and if n is even, the term = 2. I.e.

    [itex]a_{n} = 1 if \ n \ is \ odd \ and \ a_{n} = 2 \ if \ n \ is \ even[/itex]
     
  2. jcsd
  3. Mar 5, 2013 #2
    Can anyone help me come up with some a_n such that this is true?
     
  4. Mar 5, 2013 #3
    So what you are saying is ...

    For input n = 1,2,3,4,5...

    a_n = 1,2,1,2,1,2


    There are a number of ways you can do this (click on Equations for Links )...

    [itex]2- n mod(2)[/itex]

    [itex]2-[sin^2(\frac{\pi n}{2})][/itex]


    Just a couple that I thought off in my head....
    One is discrete, one is continuous
     
  5. Mar 5, 2013 #4

    pwsnafu

    User Avatar
    Science Advisor

    There is also ##\frac{3+(-1)^n}{2}##
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Series of sorts- Return 1 or 2 based on even or odd n
Loading...