Does there exist a function which equals $0$ for odd inputs and $1$ for even inputs? [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Suppose $f(n)$ is a function that equals $0$ for odd inputs of $n$ and $1$ for even inputs. Note that $n$ can only be an integer. Is there a way of explicitly defining $f(n)$ so that satisfy the above conditions, without having to use a piecewise function?







share|cite|improve this question














closed as off-topic by Nosrati, TheSimpliFire, Jyrki Lahtonen, user21820, HK Lee Sep 2 at 10:43


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – TheSimpliFire, Jyrki Lahtonen, user21820
If this question can be reworded to fit the rules in the help center, please edit the question.
















    up vote
    1
    down vote

    favorite












    Suppose $f(n)$ is a function that equals $0$ for odd inputs of $n$ and $1$ for even inputs. Note that $n$ can only be an integer. Is there a way of explicitly defining $f(n)$ so that satisfy the above conditions, without having to use a piecewise function?







    share|cite|improve this question














    closed as off-topic by Nosrati, TheSimpliFire, Jyrki Lahtonen, user21820, HK Lee Sep 2 at 10:43


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – TheSimpliFire, Jyrki Lahtonen, user21820
    If this question can be reworded to fit the rules in the help center, please edit the question.














      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Suppose $f(n)$ is a function that equals $0$ for odd inputs of $n$ and $1$ for even inputs. Note that $n$ can only be an integer. Is there a way of explicitly defining $f(n)$ so that satisfy the above conditions, without having to use a piecewise function?







      share|cite|improve this question














      Suppose $f(n)$ is a function that equals $0$ for odd inputs of $n$ and $1$ for even inputs. Note that $n$ can only be an integer. Is there a way of explicitly defining $f(n)$ so that satisfy the above conditions, without having to use a piecewise function?









      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Sep 2 at 7:51









      TheSimpliFire

      10.7k62054




      10.7k62054










      asked Sep 2 at 3:25









      Sanjoy The Manjoy

      387214




      387214




      closed as off-topic by Nosrati, TheSimpliFire, Jyrki Lahtonen, user21820, HK Lee Sep 2 at 10:43


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – TheSimpliFire, Jyrki Lahtonen, user21820
      If this question can be reworded to fit the rules in the help center, please edit the question.




      closed as off-topic by Nosrati, TheSimpliFire, Jyrki Lahtonen, user21820, HK Lee Sep 2 at 10:43


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – TheSimpliFire, Jyrki Lahtonen, user21820
      If this question can be reworded to fit the rules in the help center, please edit the question.




















          6 Answers
          6






          active

          oldest

          votes

















          up vote
          11
          down vote



          accepted










          Consider
          $$
          f(n):=frac1+(-1)^n2.
          $$






          share|cite|improve this answer



























            up vote
            6
            down vote













            Another option is $$f(n) = cos^2 left(fracnpi2right)$$






            share|cite|improve this answer



























              up vote
              6
              down vote













              Let $$f(n)=frac1+cos npi2$$






              share|cite|improve this answer



























                up vote
                4
                down vote













                Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.






                share|cite|improve this answer



























                  up vote
                  4
                  down vote













                  $f(n) := 1 - textmod(n, 2).$






                  share|cite|improve this answer



























                    up vote
                    3
                    down vote













                    $$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$






                    share|cite|improve this answer



























                      6 Answers
                      6






                      active

                      oldest

                      votes








                      6 Answers
                      6






                      active

                      oldest

                      votes









                      active

                      oldest

                      votes






                      active

                      oldest

                      votes








                      up vote
                      11
                      down vote



                      accepted










                      Consider
                      $$
                      f(n):=frac1+(-1)^n2.
                      $$






                      share|cite|improve this answer
























                        up vote
                        11
                        down vote



                        accepted










                        Consider
                        $$
                        f(n):=frac1+(-1)^n2.
                        $$






                        share|cite|improve this answer






















                          up vote
                          11
                          down vote



                          accepted







                          up vote
                          11
                          down vote



                          accepted






                          Consider
                          $$
                          f(n):=frac1+(-1)^n2.
                          $$






                          share|cite|improve this answer












                          Consider
                          $$
                          f(n):=frac1+(-1)^n2.
                          $$







                          share|cite|improve this answer












                          share|cite|improve this answer



                          share|cite|improve this answer










                          answered Sep 2 at 3:26









                          Nick Peterson

                          25.7k23859




                          25.7k23859




















                              up vote
                              6
                              down vote













                              Another option is $$f(n) = cos^2 left(fracnpi2right)$$






                              share|cite|improve this answer
























                                up vote
                                6
                                down vote













                                Another option is $$f(n) = cos^2 left(fracnpi2right)$$






                                share|cite|improve this answer






















                                  up vote
                                  6
                                  down vote










                                  up vote
                                  6
                                  down vote









                                  Another option is $$f(n) = cos^2 left(fracnpi2right)$$






                                  share|cite|improve this answer












                                  Another option is $$f(n) = cos^2 left(fracnpi2right)$$







                                  share|cite|improve this answer












                                  share|cite|improve this answer



                                  share|cite|improve this answer










                                  answered Sep 2 at 3:29









                                  mweiss

                                  17.3k23268




                                  17.3k23268




















                                      up vote
                                      6
                                      down vote













                                      Let $$f(n)=frac1+cos npi2$$






                                      share|cite|improve this answer
























                                        up vote
                                        6
                                        down vote













                                        Let $$f(n)=frac1+cos npi2$$






                                        share|cite|improve this answer






















                                          up vote
                                          6
                                          down vote










                                          up vote
                                          6
                                          down vote









                                          Let $$f(n)=frac1+cos npi2$$






                                          share|cite|improve this answer












                                          Let $$f(n)=frac1+cos npi2$$







                                          share|cite|improve this answer












                                          share|cite|improve this answer



                                          share|cite|improve this answer










                                          answered Sep 2 at 3:30









                                          bof

                                          46.7k349113




                                          46.7k349113




















                                              up vote
                                              4
                                              down vote













                                              Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.






                                              share|cite|improve this answer
























                                                up vote
                                                4
                                                down vote













                                                Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.






                                                share|cite|improve this answer






















                                                  up vote
                                                  4
                                                  down vote










                                                  up vote
                                                  4
                                                  down vote









                                                  Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.






                                                  share|cite|improve this answer












                                                  Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.







                                                  share|cite|improve this answer












                                                  share|cite|improve this answer



                                                  share|cite|improve this answer










                                                  answered Sep 2 at 3:31









                                                  dxiv

                                                  55.8k64798




                                                  55.8k64798




















                                                      up vote
                                                      4
                                                      down vote













                                                      $f(n) := 1 - textmod(n, 2).$






                                                      share|cite|improve this answer
























                                                        up vote
                                                        4
                                                        down vote













                                                        $f(n) := 1 - textmod(n, 2).$






                                                        share|cite|improve this answer






















                                                          up vote
                                                          4
                                                          down vote










                                                          up vote
                                                          4
                                                          down vote









                                                          $f(n) := 1 - textmod(n, 2).$






                                                          share|cite|improve this answer












                                                          $f(n) := 1 - textmod(n, 2).$







                                                          share|cite|improve this answer












                                                          share|cite|improve this answer



                                                          share|cite|improve this answer










                                                          answered Sep 2 at 5:01









                                                          Somos

                                                          11.8k11033




                                                          11.8k11033




















                                                              up vote
                                                              3
                                                              down vote













                                                              $$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$






                                                              share|cite|improve this answer
























                                                                up vote
                                                                3
                                                                down vote













                                                                $$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$






                                                                share|cite|improve this answer






















                                                                  up vote
                                                                  3
                                                                  down vote










                                                                  up vote
                                                                  3
                                                                  down vote









                                                                  $$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$






                                                                  share|cite|improve this answer












                                                                  $$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$







                                                                  share|cite|improve this answer












                                                                  share|cite|improve this answer



                                                                  share|cite|improve this answer










                                                                  answered Sep 2 at 3:36









                                                                  Ahmad Bazzi

                                                                  4,5201623




                                                                  4,5201623












                                                                      Comments

                                                                      Popular posts from this blog

                                                                      List of Gilmore Girls characters

                                                                      What does second last employer means? [closed]

                                                                      One-line joke