Does there exist a function which equals $0$ for odd inputs and $1$ for even inputs? [closed]
Clash 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?
analysis functions
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
add a comment |Â
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?
analysis functions
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
add a comment |Â
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?
analysis functions
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?
analysis functions
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
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
add a comment |Â
add a comment |Â
6 Answers
6
active
oldest
votes
up vote
11
down vote
accepted
Consider
$$
f(n):=frac1+(-1)^n2.
$$
add a comment |Â
up vote
6
down vote
Another option is $$f(n) = cos^2 left(fracnpi2right)$$
add a comment |Â
up vote
6
down vote
Let $$f(n)=frac1+cos npi2$$
add a comment |Â
up vote
4
down vote
Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.
add a comment |Â
up vote
4
down vote
$f(n) := 1 - textmod(n, 2).$
add a comment |Â
up vote
3
down vote
$$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$
add a comment |Â
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.
$$
add a comment |Â
up vote
11
down vote
accepted
Consider
$$
f(n):=frac1+(-1)^n2.
$$
add a comment |Â
up vote
11
down vote
accepted
up vote
11
down vote
accepted
Consider
$$
f(n):=frac1+(-1)^n2.
$$
Consider
$$
f(n):=frac1+(-1)^n2.
$$
answered Sep 2 at 3:26
Nick Peterson
25.7k23859
25.7k23859
add a comment |Â
add a comment |Â
up vote
6
down vote
Another option is $$f(n) = cos^2 left(fracnpi2right)$$
add a comment |Â
up vote
6
down vote
Another option is $$f(n) = cos^2 left(fracnpi2right)$$
add a comment |Â
up vote
6
down vote
up vote
6
down vote
Another option is $$f(n) = cos^2 left(fracnpi2right)$$
Another option is $$f(n) = cos^2 left(fracnpi2right)$$
answered Sep 2 at 3:29


mweiss
17.3k23268
17.3k23268
add a comment |Â
add a comment |Â
up vote
6
down vote
Let $$f(n)=frac1+cos npi2$$
add a comment |Â
up vote
6
down vote
Let $$f(n)=frac1+cos npi2$$
add a comment |Â
up vote
6
down vote
up vote
6
down vote
Let $$f(n)=frac1+cos npi2$$
Let $$f(n)=frac1+cos npi2$$
answered Sep 2 at 3:30
bof
46.7k349113
46.7k349113
add a comment |Â
add a comment |Â
up vote
4
down vote
Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.
add a comment |Â
up vote
4
down vote
Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.
Yet another one: $;f(n) = 1 - leftlfloor fracn+12rightrfloor + leftlfloor fracn2rightrfloor,$.
answered Sep 2 at 3:31


dxiv
55.8k64798
55.8k64798
add a comment |Â
add a comment |Â
up vote
4
down vote
$f(n) := 1 - textmod(n, 2).$
add a comment |Â
up vote
4
down vote
$f(n) := 1 - textmod(n, 2).$
add a comment |Â
up vote
4
down vote
up vote
4
down vote
$f(n) := 1 - textmod(n, 2).$
$f(n) := 1 - textmod(n, 2).$
answered Sep 2 at 5:01


Somos
11.8k11033
11.8k11033
add a comment |Â
add a comment |Â
up vote
3
down vote
$$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$
add a comment |Â
up vote
3
down vote
$$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$
add a comment |Â
up vote
3
down vote
up vote
3
down vote
$$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$
$$f(n) = 1 -( n -2 lfloor fracn2 rfloor)$$
answered Sep 2 at 3:36


Ahmad Bazzi
4,5201623
4,5201623
add a comment |Â
add a comment |Â