Math formula to check two integers [closed]












3












$begingroup$


I was just wondering if there is a way to check that two unknowns are integers as follows:-

if x and y are two values, and I want to know if these two values are integers by using a formula,

I tried adding them and checking if the sum is an integer but I found out that two numbers can be decimal and give integer result (ex. 1.5 + 2.5 = 4), I also tried multiplying them and checking if the product is integer but I found out that two decimals can have an integer product (ex. 1.2 x 2.5 = 3). It's all about checking if x and y both belong to integers and not solving a specific equation.



Summary: "if formula (including x and y) gives a specific result then x and y are integers"

what is the formula ?



NOTE : I want a way that helps in solving equations, so avoid answers like $f(x) = 1 ( x in Bbb Z)$. In addition, I don't want to check x and y separately but both at the same time.










share|cite|improve this question











$endgroup$



closed as unclear what you're asking by Yves Daoust, max_zorn, Cesareo, darij grinberg, Lord Shark the Unknown Feb 3 at 6:19


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • $begingroup$
    Do you mean, like adecima$l^{another decimal}$?
    $endgroup$
    – Math Lover
    Jan 27 at 15:07










  • $begingroup$
    I mean, you can always use logarithm and roots to find them, if you want :)
    $endgroup$
    – Math Lover
    Jan 27 at 15:11






  • 1




    $begingroup$
    The wording of your question makes it very hard to understand, and the title is inexpressive. You can "check" the two numbers independently.
    $endgroup$
    – Yves Daoust
    Jan 27 at 15:51








  • 1




    $begingroup$
    If $x=int(x)$ and $y=int(y)$
    $endgroup$
    – J. W. Tanner
    Jan 27 at 16:32






  • 1




    $begingroup$
    Are $x$ and $y$ still supposed to be unknown at the time of checking? If so, the answer will depend on what information you have about $x$ and $y$.
    $endgroup$
    – timtfj
    Jan 27 at 16:34
















3












$begingroup$


I was just wondering if there is a way to check that two unknowns are integers as follows:-

if x and y are two values, and I want to know if these two values are integers by using a formula,

I tried adding them and checking if the sum is an integer but I found out that two numbers can be decimal and give integer result (ex. 1.5 + 2.5 = 4), I also tried multiplying them and checking if the product is integer but I found out that two decimals can have an integer product (ex. 1.2 x 2.5 = 3). It's all about checking if x and y both belong to integers and not solving a specific equation.



Summary: "if formula (including x and y) gives a specific result then x and y are integers"

what is the formula ?



NOTE : I want a way that helps in solving equations, so avoid answers like $f(x) = 1 ( x in Bbb Z)$. In addition, I don't want to check x and y separately but both at the same time.










share|cite|improve this question











$endgroup$



closed as unclear what you're asking by Yves Daoust, max_zorn, Cesareo, darij grinberg, Lord Shark the Unknown Feb 3 at 6:19


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • $begingroup$
    Do you mean, like adecima$l^{another decimal}$?
    $endgroup$
    – Math Lover
    Jan 27 at 15:07










  • $begingroup$
    I mean, you can always use logarithm and roots to find them, if you want :)
    $endgroup$
    – Math Lover
    Jan 27 at 15:11






  • 1




    $begingroup$
    The wording of your question makes it very hard to understand, and the title is inexpressive. You can "check" the two numbers independently.
    $endgroup$
    – Yves Daoust
    Jan 27 at 15:51








  • 1




    $begingroup$
    If $x=int(x)$ and $y=int(y)$
    $endgroup$
    – J. W. Tanner
    Jan 27 at 16:32






  • 1




    $begingroup$
    Are $x$ and $y$ still supposed to be unknown at the time of checking? If so, the answer will depend on what information you have about $x$ and $y$.
    $endgroup$
    – timtfj
    Jan 27 at 16:34














3












3








3





$begingroup$


I was just wondering if there is a way to check that two unknowns are integers as follows:-

if x and y are two values, and I want to know if these two values are integers by using a formula,

I tried adding them and checking if the sum is an integer but I found out that two numbers can be decimal and give integer result (ex. 1.5 + 2.5 = 4), I also tried multiplying them and checking if the product is integer but I found out that two decimals can have an integer product (ex. 1.2 x 2.5 = 3). It's all about checking if x and y both belong to integers and not solving a specific equation.



Summary: "if formula (including x and y) gives a specific result then x and y are integers"

what is the formula ?



NOTE : I want a way that helps in solving equations, so avoid answers like $f(x) = 1 ( x in Bbb Z)$. In addition, I don't want to check x and y separately but both at the same time.










share|cite|improve this question











$endgroup$




I was just wondering if there is a way to check that two unknowns are integers as follows:-

if x and y are two values, and I want to know if these two values are integers by using a formula,

I tried adding them and checking if the sum is an integer but I found out that two numbers can be decimal and give integer result (ex. 1.5 + 2.5 = 4), I also tried multiplying them and checking if the product is integer but I found out that two decimals can have an integer product (ex. 1.2 x 2.5 = 3). It's all about checking if x and y both belong to integers and not solving a specific equation.



Summary: "if formula (including x and y) gives a specific result then x and y are integers"

what is the formula ?



NOTE : I want a way that helps in solving equations, so avoid answers like $f(x) = 1 ( x in Bbb Z)$. In addition, I don't want to check x and y separately but both at the same time.







integers






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Feb 2 at 14:28







anas pcpro

















asked Jan 27 at 15:02









anas pcproanas pcpro

96110




96110




closed as unclear what you're asking by Yves Daoust, max_zorn, Cesareo, darij grinberg, Lord Shark the Unknown Feb 3 at 6:19


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by Yves Daoust, max_zorn, Cesareo, darij grinberg, Lord Shark the Unknown Feb 3 at 6:19


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • $begingroup$
    Do you mean, like adecima$l^{another decimal}$?
    $endgroup$
    – Math Lover
    Jan 27 at 15:07










  • $begingroup$
    I mean, you can always use logarithm and roots to find them, if you want :)
    $endgroup$
    – Math Lover
    Jan 27 at 15:11






  • 1




    $begingroup$
    The wording of your question makes it very hard to understand, and the title is inexpressive. You can "check" the two numbers independently.
    $endgroup$
    – Yves Daoust
    Jan 27 at 15:51








  • 1




    $begingroup$
    If $x=int(x)$ and $y=int(y)$
    $endgroup$
    – J. W. Tanner
    Jan 27 at 16:32






  • 1




    $begingroup$
    Are $x$ and $y$ still supposed to be unknown at the time of checking? If so, the answer will depend on what information you have about $x$ and $y$.
    $endgroup$
    – timtfj
    Jan 27 at 16:34


















  • $begingroup$
    Do you mean, like adecima$l^{another decimal}$?
    $endgroup$
    – Math Lover
    Jan 27 at 15:07










  • $begingroup$
    I mean, you can always use logarithm and roots to find them, if you want :)
    $endgroup$
    – Math Lover
    Jan 27 at 15:11






  • 1




    $begingroup$
    The wording of your question makes it very hard to understand, and the title is inexpressive. You can "check" the two numbers independently.
    $endgroup$
    – Yves Daoust
    Jan 27 at 15:51








  • 1




    $begingroup$
    If $x=int(x)$ and $y=int(y)$
    $endgroup$
    – J. W. Tanner
    Jan 27 at 16:32






  • 1




    $begingroup$
    Are $x$ and $y$ still supposed to be unknown at the time of checking? If so, the answer will depend on what information you have about $x$ and $y$.
    $endgroup$
    – timtfj
    Jan 27 at 16:34
















$begingroup$
Do you mean, like adecima$l^{another decimal}$?
$endgroup$
– Math Lover
Jan 27 at 15:07




$begingroup$
Do you mean, like adecima$l^{another decimal}$?
$endgroup$
– Math Lover
Jan 27 at 15:07












$begingroup$
I mean, you can always use logarithm and roots to find them, if you want :)
$endgroup$
– Math Lover
Jan 27 at 15:11




$begingroup$
I mean, you can always use logarithm and roots to find them, if you want :)
$endgroup$
– Math Lover
Jan 27 at 15:11




1




1




$begingroup$
The wording of your question makes it very hard to understand, and the title is inexpressive. You can "check" the two numbers independently.
$endgroup$
– Yves Daoust
Jan 27 at 15:51






$begingroup$
The wording of your question makes it very hard to understand, and the title is inexpressive. You can "check" the two numbers independently.
$endgroup$
– Yves Daoust
Jan 27 at 15:51






1




1




$begingroup$
If $x=int(x)$ and $y=int(y)$
$endgroup$
– J. W. Tanner
Jan 27 at 16:32




$begingroup$
If $x=int(x)$ and $y=int(y)$
$endgroup$
– J. W. Tanner
Jan 27 at 16:32




1




1




$begingroup$
Are $x$ and $y$ still supposed to be unknown at the time of checking? If so, the answer will depend on what information you have about $x$ and $y$.
$endgroup$
– timtfj
Jan 27 at 16:34




$begingroup$
Are $x$ and $y$ still supposed to be unknown at the time of checking? If so, the answer will depend on what information you have about $x$ and $y$.
$endgroup$
– timtfj
Jan 27 at 16:34










4 Answers
4






active

oldest

votes


















2





+50







$begingroup$

There are a lot of functions that meet your criteria.



First, there is this function. It is boring, as it defeats the point of the question, but it is worth noting that it is a mathematically valid function:



1) $f(x, y) = cases{1 & if $x$ and $y$ are integers \ 0 & otherwise}$



Similarly, there's



2) $f(x, y) = {x} times {y}$ where {x} denotes the fractional part of x.



So it would be a good idea to set some additional restrictions on our functions to have a meaningful question.



A typical restriction could be to ask for functions that are continuous and differentiable (smooth), as most functions and operation we use (addition, subtraction, multiplication, trig, etc.) have this property. Here is a continuous and differentiable (smooth) function that works:



3) $f(x, y) = sin^2(pi x) + sin^2(pi y)$



This is 0 iff both $x$ and $y$ are integers.



Let's consider continuous and differentiable functions with a bit more generality. Suppose $f(m, n) = k$ for some integers $m$ and $n$. Consider a contour plot line at height $k$. We can then then move slightly along the line, and make $m$ and/or $n$ not integer while preserving the value $k$... Unless $(m, n)$ is a maximum or a minimum, and so the contour line is actually just a point. This means, we need functions that have maxima or minima at every integer point.



This means, there aren't any such functions that can be expressed in terms of only elementary operations (addition, subtraction, multiplication, division, roots).






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you very much, but there is a problem, such functions doesn't help in solving equations the only one I thought it could help was no. 3 but unfortunately, it seems not working as I tried x=2 and y=3 : $ sin^2 (2 pi) + sin^2 (3 pi) approx 0.3879 $. I know it's a very small value but it can make big difference in long equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:59










  • $begingroup$
    @anaspcpro You must have miscalculated something. $sin^2(2pi) + sin^2(3pi)=0$: wolframalpha.com/input/?i=sin%5E2(2pi)+%2B+sin%5E2(3pi)
    $endgroup$
    – Todor Markov
    Feb 2 at 14:34












  • $begingroup$
    I tried that many times trying different numbers on a CASIO fx-570ES Plus calculator and also on windows 7 calculator,however google calculator said it's equal to zero and Wolfarmalpha doesn't work for me, it gives blank result .
    $endgroup$
    – anas pcpro
    Feb 2 at 14:57










  • $begingroup$
    @anaspcpro Perhaps those calculators interpret the order of operations or something differently. Make sure it's $[sin(pi x)]^2 + [sin(pi y)]^2$. Since $sin(npi) = 0$ for all integers $n$, so when you square it it will still be zero, and then you add up two zeros.
    $endgroup$
    – Todor Markov
    Feb 2 at 15:25








  • 1




    $begingroup$
    @anaspcpro With just sin it will be 0 at all integers, but can be zero for non-integers too. For example $sin(0.5pi) + sin(1.5pi)$ is also 0 (because one part is positive the other negative). Squaring prevents that.
    $endgroup$
    – Todor Markov
    Feb 3 at 17:07



















2












$begingroup$

Yes, you have two equations $$begin{align}x+y&=n\xy&=mend{align}$$ where $n$ and $m$ are known. From the first, $y=n-x$ Substitute this into the second, and use the quadratic formula to check if the solutions are integers.



EDIT
The substitution gives $$x^2-nx+m=0$$ By the quadratic formula, $$x={npmsqrt{n^2-4m}over2}$$ So now you can check if this is an integer. You need $n^2-4m$ to be a perfect square, and the fraction to work out to a whole number. If $x$ is an integer, so is $y,$ since $n$ and $m$ have to be integers. (If $m$ and $m$ aren't integers, there's no possibility of integral solution.)



I overlooked the line beginning "So is there any exact way ..." before, and I'm afraid I don't understand what you mean.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Sorry, I didn't understand well. Did you mean checking that xy = x(x-n) = x^2-nx = m ? I think it is still the same.
    $endgroup$
    – anas pcpro
    Jan 27 at 15:39





















1












$begingroup$

Given a real value $t$, there is a well-known and widely used formula ${t}$, denoting the fractional part of $t$. Remark that $0le {t}le 1$ for each real $t$ and $t$ is integer if and only if ${t}=0$. Therefore, given real number $x$ and $y$ a formula



$${x}+{y}$$



equals to zero if and only if both $x$ and $y$ are integers.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you so much for this answer, but I can't find a way to simplify this and use it in equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:47










  • $begingroup$
    @anaspcpro Which operations you can use in equations?
    $endgroup$
    – Alex Ravsky
    Feb 2 at 13:48



















1












$begingroup$

The problem of any real number $x$ being an integer can be approached by using three functions.



1.) {$x$}, the fractional part of $x$

2.) $lfloor x rfloor$, the floor function of $x$ which returns the greatest integer less than or equal to $x$



3.) $lceil x rceil$, the ceiling function of $x$ which returns the least integer greater than or equal to $x$



As already explained by @Alex Ravsky about the fractional part, you can get to know individually whether $x$ and $y$ are separately integers or not.



$$Input(x) rightarrow boxed{left{xright}} rightarrow Output(y)$$
Here if $y$ = $0$, then the input is certainly an integer.



$Floor function$:
$$Input(x) rightarrow boxed{lfloor x rfloor} rightarrow Output(y)$$
Here the output $y$ is the greatest integer which is less than or equal to $x$
For e.x. if the input is $1.33$ he output will be the greatest integer which is less or equal $1.33$. Now the integers $-2, -1,0,1$ all are less than $1.33$ but the floor function will return $1$ since it is the greatest integer less or equal $1.33$.



$$Test: lfloor x rfloor =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$



Using programming you can run a loop which checks for all integers one by one and returns the (greatest)integer less or equal $x$.



$Ceiling Function:$
$$Input(x) rightarrow boxed{lceil x rceil} rightarrow Output(y)$$
Here the output $y$ will be the smallest integer greater than or equal to $x$. Lets say the input is $3.5$ then there are many integers greater than or equal to $3.5$. But we will choose the least integer which is $4$.



$$Test: lceil x rceil =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$
Using programming you can run a loop which checks for all integers one by one and returns the (least)integer greater or equal $x$.



The concept of any real number being an integer is simple. Any real number can be expressed in a decimal representation(recurring or non recurring). So we just need to truncate the fractional part of the real number to get the integer. These three functions help to truncate the fractional part so that we are left with an integer.



Finally each of these things can be checked using programming. Now every real decimal number is stored as a data type float. If you try to change your type to integer the decimal part is truncated.



int x =3.5;



will actually store only $3$ in the variable $x$. So you can also return an integer from a decimal value. In C programming storing a real value in integer type or just typecasting the real number to integer type will return you an integer.



Combining all this :
Checking $x$ and $y$ individually through both the floor and ceiling functions will tell you whether both of them are integers or not. No requirement to check whether the sum is an integer or the product is an integer or not.



Hope this helps.....






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you very much for all of this information, but I don't want to check them SEPARATELY, I want to check them both at the same time.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:42


















4 Answers
4






active

oldest

votes








4 Answers
4






active

oldest

votes









active

oldest

votes






active

oldest

votes









2





+50







$begingroup$

There are a lot of functions that meet your criteria.



First, there is this function. It is boring, as it defeats the point of the question, but it is worth noting that it is a mathematically valid function:



1) $f(x, y) = cases{1 & if $x$ and $y$ are integers \ 0 & otherwise}$



Similarly, there's



2) $f(x, y) = {x} times {y}$ where {x} denotes the fractional part of x.



So it would be a good idea to set some additional restrictions on our functions to have a meaningful question.



A typical restriction could be to ask for functions that are continuous and differentiable (smooth), as most functions and operation we use (addition, subtraction, multiplication, trig, etc.) have this property. Here is a continuous and differentiable (smooth) function that works:



3) $f(x, y) = sin^2(pi x) + sin^2(pi y)$



This is 0 iff both $x$ and $y$ are integers.



Let's consider continuous and differentiable functions with a bit more generality. Suppose $f(m, n) = k$ for some integers $m$ and $n$. Consider a contour plot line at height $k$. We can then then move slightly along the line, and make $m$ and/or $n$ not integer while preserving the value $k$... Unless $(m, n)$ is a maximum or a minimum, and so the contour line is actually just a point. This means, we need functions that have maxima or minima at every integer point.



This means, there aren't any such functions that can be expressed in terms of only elementary operations (addition, subtraction, multiplication, division, roots).






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you very much, but there is a problem, such functions doesn't help in solving equations the only one I thought it could help was no. 3 but unfortunately, it seems not working as I tried x=2 and y=3 : $ sin^2 (2 pi) + sin^2 (3 pi) approx 0.3879 $. I know it's a very small value but it can make big difference in long equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:59










  • $begingroup$
    @anaspcpro You must have miscalculated something. $sin^2(2pi) + sin^2(3pi)=0$: wolframalpha.com/input/?i=sin%5E2(2pi)+%2B+sin%5E2(3pi)
    $endgroup$
    – Todor Markov
    Feb 2 at 14:34












  • $begingroup$
    I tried that many times trying different numbers on a CASIO fx-570ES Plus calculator and also on windows 7 calculator,however google calculator said it's equal to zero and Wolfarmalpha doesn't work for me, it gives blank result .
    $endgroup$
    – anas pcpro
    Feb 2 at 14:57










  • $begingroup$
    @anaspcpro Perhaps those calculators interpret the order of operations or something differently. Make sure it's $[sin(pi x)]^2 + [sin(pi y)]^2$. Since $sin(npi) = 0$ for all integers $n$, so when you square it it will still be zero, and then you add up two zeros.
    $endgroup$
    – Todor Markov
    Feb 2 at 15:25








  • 1




    $begingroup$
    @anaspcpro With just sin it will be 0 at all integers, but can be zero for non-integers too. For example $sin(0.5pi) + sin(1.5pi)$ is also 0 (because one part is positive the other negative). Squaring prevents that.
    $endgroup$
    – Todor Markov
    Feb 3 at 17:07
















2





+50







$begingroup$

There are a lot of functions that meet your criteria.



First, there is this function. It is boring, as it defeats the point of the question, but it is worth noting that it is a mathematically valid function:



1) $f(x, y) = cases{1 & if $x$ and $y$ are integers \ 0 & otherwise}$



Similarly, there's



2) $f(x, y) = {x} times {y}$ where {x} denotes the fractional part of x.



So it would be a good idea to set some additional restrictions on our functions to have a meaningful question.



A typical restriction could be to ask for functions that are continuous and differentiable (smooth), as most functions and operation we use (addition, subtraction, multiplication, trig, etc.) have this property. Here is a continuous and differentiable (smooth) function that works:



3) $f(x, y) = sin^2(pi x) + sin^2(pi y)$



This is 0 iff both $x$ and $y$ are integers.



Let's consider continuous and differentiable functions with a bit more generality. Suppose $f(m, n) = k$ for some integers $m$ and $n$. Consider a contour plot line at height $k$. We can then then move slightly along the line, and make $m$ and/or $n$ not integer while preserving the value $k$... Unless $(m, n)$ is a maximum or a minimum, and so the contour line is actually just a point. This means, we need functions that have maxima or minima at every integer point.



This means, there aren't any such functions that can be expressed in terms of only elementary operations (addition, subtraction, multiplication, division, roots).






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you very much, but there is a problem, such functions doesn't help in solving equations the only one I thought it could help was no. 3 but unfortunately, it seems not working as I tried x=2 and y=3 : $ sin^2 (2 pi) + sin^2 (3 pi) approx 0.3879 $. I know it's a very small value but it can make big difference in long equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:59










  • $begingroup$
    @anaspcpro You must have miscalculated something. $sin^2(2pi) + sin^2(3pi)=0$: wolframalpha.com/input/?i=sin%5E2(2pi)+%2B+sin%5E2(3pi)
    $endgroup$
    – Todor Markov
    Feb 2 at 14:34












  • $begingroup$
    I tried that many times trying different numbers on a CASIO fx-570ES Plus calculator and also on windows 7 calculator,however google calculator said it's equal to zero and Wolfarmalpha doesn't work for me, it gives blank result .
    $endgroup$
    – anas pcpro
    Feb 2 at 14:57










  • $begingroup$
    @anaspcpro Perhaps those calculators interpret the order of operations or something differently. Make sure it's $[sin(pi x)]^2 + [sin(pi y)]^2$. Since $sin(npi) = 0$ for all integers $n$, so when you square it it will still be zero, and then you add up two zeros.
    $endgroup$
    – Todor Markov
    Feb 2 at 15:25








  • 1




    $begingroup$
    @anaspcpro With just sin it will be 0 at all integers, but can be zero for non-integers too. For example $sin(0.5pi) + sin(1.5pi)$ is also 0 (because one part is positive the other negative). Squaring prevents that.
    $endgroup$
    – Todor Markov
    Feb 3 at 17:07














2





+50







2





+50



2




+50



$begingroup$

There are a lot of functions that meet your criteria.



First, there is this function. It is boring, as it defeats the point of the question, but it is worth noting that it is a mathematically valid function:



1) $f(x, y) = cases{1 & if $x$ and $y$ are integers \ 0 & otherwise}$



Similarly, there's



2) $f(x, y) = {x} times {y}$ where {x} denotes the fractional part of x.



So it would be a good idea to set some additional restrictions on our functions to have a meaningful question.



A typical restriction could be to ask for functions that are continuous and differentiable (smooth), as most functions and operation we use (addition, subtraction, multiplication, trig, etc.) have this property. Here is a continuous and differentiable (smooth) function that works:



3) $f(x, y) = sin^2(pi x) + sin^2(pi y)$



This is 0 iff both $x$ and $y$ are integers.



Let's consider continuous and differentiable functions with a bit more generality. Suppose $f(m, n) = k$ for some integers $m$ and $n$. Consider a contour plot line at height $k$. We can then then move slightly along the line, and make $m$ and/or $n$ not integer while preserving the value $k$... Unless $(m, n)$ is a maximum or a minimum, and so the contour line is actually just a point. This means, we need functions that have maxima or minima at every integer point.



This means, there aren't any such functions that can be expressed in terms of only elementary operations (addition, subtraction, multiplication, division, roots).






share|cite|improve this answer









$endgroup$



There are a lot of functions that meet your criteria.



First, there is this function. It is boring, as it defeats the point of the question, but it is worth noting that it is a mathematically valid function:



1) $f(x, y) = cases{1 & if $x$ and $y$ are integers \ 0 & otherwise}$



Similarly, there's



2) $f(x, y) = {x} times {y}$ where {x} denotes the fractional part of x.



So it would be a good idea to set some additional restrictions on our functions to have a meaningful question.



A typical restriction could be to ask for functions that are continuous and differentiable (smooth), as most functions and operation we use (addition, subtraction, multiplication, trig, etc.) have this property. Here is a continuous and differentiable (smooth) function that works:



3) $f(x, y) = sin^2(pi x) + sin^2(pi y)$



This is 0 iff both $x$ and $y$ are integers.



Let's consider continuous and differentiable functions with a bit more generality. Suppose $f(m, n) = k$ for some integers $m$ and $n$. Consider a contour plot line at height $k$. We can then then move slightly along the line, and make $m$ and/or $n$ not integer while preserving the value $k$... Unless $(m, n)$ is a maximum or a minimum, and so the contour line is actually just a point. This means, we need functions that have maxima or minima at every integer point.



This means, there aren't any such functions that can be expressed in terms of only elementary operations (addition, subtraction, multiplication, division, roots).







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Feb 2 at 12:31









Todor MarkovTodor Markov

2,420412




2,420412












  • $begingroup$
    Thank you very much, but there is a problem, such functions doesn't help in solving equations the only one I thought it could help was no. 3 but unfortunately, it seems not working as I tried x=2 and y=3 : $ sin^2 (2 pi) + sin^2 (3 pi) approx 0.3879 $. I know it's a very small value but it can make big difference in long equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:59










  • $begingroup$
    @anaspcpro You must have miscalculated something. $sin^2(2pi) + sin^2(3pi)=0$: wolframalpha.com/input/?i=sin%5E2(2pi)+%2B+sin%5E2(3pi)
    $endgroup$
    – Todor Markov
    Feb 2 at 14:34












  • $begingroup$
    I tried that many times trying different numbers on a CASIO fx-570ES Plus calculator and also on windows 7 calculator,however google calculator said it's equal to zero and Wolfarmalpha doesn't work for me, it gives blank result .
    $endgroup$
    – anas pcpro
    Feb 2 at 14:57










  • $begingroup$
    @anaspcpro Perhaps those calculators interpret the order of operations or something differently. Make sure it's $[sin(pi x)]^2 + [sin(pi y)]^2$. Since $sin(npi) = 0$ for all integers $n$, so when you square it it will still be zero, and then you add up two zeros.
    $endgroup$
    – Todor Markov
    Feb 2 at 15:25








  • 1




    $begingroup$
    @anaspcpro With just sin it will be 0 at all integers, but can be zero for non-integers too. For example $sin(0.5pi) + sin(1.5pi)$ is also 0 (because one part is positive the other negative). Squaring prevents that.
    $endgroup$
    – Todor Markov
    Feb 3 at 17:07


















  • $begingroup$
    Thank you very much, but there is a problem, such functions doesn't help in solving equations the only one I thought it could help was no. 3 but unfortunately, it seems not working as I tried x=2 and y=3 : $ sin^2 (2 pi) + sin^2 (3 pi) approx 0.3879 $. I know it's a very small value but it can make big difference in long equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:59










  • $begingroup$
    @anaspcpro You must have miscalculated something. $sin^2(2pi) + sin^2(3pi)=0$: wolframalpha.com/input/?i=sin%5E2(2pi)+%2B+sin%5E2(3pi)
    $endgroup$
    – Todor Markov
    Feb 2 at 14:34












  • $begingroup$
    I tried that many times trying different numbers on a CASIO fx-570ES Plus calculator and also on windows 7 calculator,however google calculator said it's equal to zero and Wolfarmalpha doesn't work for me, it gives blank result .
    $endgroup$
    – anas pcpro
    Feb 2 at 14:57










  • $begingroup$
    @anaspcpro Perhaps those calculators interpret the order of operations or something differently. Make sure it's $[sin(pi x)]^2 + [sin(pi y)]^2$. Since $sin(npi) = 0$ for all integers $n$, so when you square it it will still be zero, and then you add up two zeros.
    $endgroup$
    – Todor Markov
    Feb 2 at 15:25








  • 1




    $begingroup$
    @anaspcpro With just sin it will be 0 at all integers, but can be zero for non-integers too. For example $sin(0.5pi) + sin(1.5pi)$ is also 0 (because one part is positive the other negative). Squaring prevents that.
    $endgroup$
    – Todor Markov
    Feb 3 at 17:07
















$begingroup$
Thank you very much, but there is a problem, such functions doesn't help in solving equations the only one I thought it could help was no. 3 but unfortunately, it seems not working as I tried x=2 and y=3 : $ sin^2 (2 pi) + sin^2 (3 pi) approx 0.3879 $. I know it's a very small value but it can make big difference in long equations.
$endgroup$
– anas pcpro
Feb 2 at 13:59




$begingroup$
Thank you very much, but there is a problem, such functions doesn't help in solving equations the only one I thought it could help was no. 3 but unfortunately, it seems not working as I tried x=2 and y=3 : $ sin^2 (2 pi) + sin^2 (3 pi) approx 0.3879 $. I know it's a very small value but it can make big difference in long equations.
$endgroup$
– anas pcpro
Feb 2 at 13:59












$begingroup$
@anaspcpro You must have miscalculated something. $sin^2(2pi) + sin^2(3pi)=0$: wolframalpha.com/input/?i=sin%5E2(2pi)+%2B+sin%5E2(3pi)
$endgroup$
– Todor Markov
Feb 2 at 14:34






$begingroup$
@anaspcpro You must have miscalculated something. $sin^2(2pi) + sin^2(3pi)=0$: wolframalpha.com/input/?i=sin%5E2(2pi)+%2B+sin%5E2(3pi)
$endgroup$
– Todor Markov
Feb 2 at 14:34














$begingroup$
I tried that many times trying different numbers on a CASIO fx-570ES Plus calculator and also on windows 7 calculator,however google calculator said it's equal to zero and Wolfarmalpha doesn't work for me, it gives blank result .
$endgroup$
– anas pcpro
Feb 2 at 14:57




$begingroup$
I tried that many times trying different numbers on a CASIO fx-570ES Plus calculator and also on windows 7 calculator,however google calculator said it's equal to zero and Wolfarmalpha doesn't work for me, it gives blank result .
$endgroup$
– anas pcpro
Feb 2 at 14:57












$begingroup$
@anaspcpro Perhaps those calculators interpret the order of operations or something differently. Make sure it's $[sin(pi x)]^2 + [sin(pi y)]^2$. Since $sin(npi) = 0$ for all integers $n$, so when you square it it will still be zero, and then you add up two zeros.
$endgroup$
– Todor Markov
Feb 2 at 15:25






$begingroup$
@anaspcpro Perhaps those calculators interpret the order of operations or something differently. Make sure it's $[sin(pi x)]^2 + [sin(pi y)]^2$. Since $sin(npi) = 0$ for all integers $n$, so when you square it it will still be zero, and then you add up two zeros.
$endgroup$
– Todor Markov
Feb 2 at 15:25






1




1




$begingroup$
@anaspcpro With just sin it will be 0 at all integers, but can be zero for non-integers too. For example $sin(0.5pi) + sin(1.5pi)$ is also 0 (because one part is positive the other negative). Squaring prevents that.
$endgroup$
– Todor Markov
Feb 3 at 17:07




$begingroup$
@anaspcpro With just sin it will be 0 at all integers, but can be zero for non-integers too. For example $sin(0.5pi) + sin(1.5pi)$ is also 0 (because one part is positive the other negative). Squaring prevents that.
$endgroup$
– Todor Markov
Feb 3 at 17:07











2












$begingroup$

Yes, you have two equations $$begin{align}x+y&=n\xy&=mend{align}$$ where $n$ and $m$ are known. From the first, $y=n-x$ Substitute this into the second, and use the quadratic formula to check if the solutions are integers.



EDIT
The substitution gives $$x^2-nx+m=0$$ By the quadratic formula, $$x={npmsqrt{n^2-4m}over2}$$ So now you can check if this is an integer. You need $n^2-4m$ to be a perfect square, and the fraction to work out to a whole number. If $x$ is an integer, so is $y,$ since $n$ and $m$ have to be integers. (If $m$ and $m$ aren't integers, there's no possibility of integral solution.)



I overlooked the line beginning "So is there any exact way ..." before, and I'm afraid I don't understand what you mean.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Sorry, I didn't understand well. Did you mean checking that xy = x(x-n) = x^2-nx = m ? I think it is still the same.
    $endgroup$
    – anas pcpro
    Jan 27 at 15:39


















2












$begingroup$

Yes, you have two equations $$begin{align}x+y&=n\xy&=mend{align}$$ where $n$ and $m$ are known. From the first, $y=n-x$ Substitute this into the second, and use the quadratic formula to check if the solutions are integers.



EDIT
The substitution gives $$x^2-nx+m=0$$ By the quadratic formula, $$x={npmsqrt{n^2-4m}over2}$$ So now you can check if this is an integer. You need $n^2-4m$ to be a perfect square, and the fraction to work out to a whole number. If $x$ is an integer, so is $y,$ since $n$ and $m$ have to be integers. (If $m$ and $m$ aren't integers, there's no possibility of integral solution.)



I overlooked the line beginning "So is there any exact way ..." before, and I'm afraid I don't understand what you mean.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Sorry, I didn't understand well. Did you mean checking that xy = x(x-n) = x^2-nx = m ? I think it is still the same.
    $endgroup$
    – anas pcpro
    Jan 27 at 15:39
















2












2








2





$begingroup$

Yes, you have two equations $$begin{align}x+y&=n\xy&=mend{align}$$ where $n$ and $m$ are known. From the first, $y=n-x$ Substitute this into the second, and use the quadratic formula to check if the solutions are integers.



EDIT
The substitution gives $$x^2-nx+m=0$$ By the quadratic formula, $$x={npmsqrt{n^2-4m}over2}$$ So now you can check if this is an integer. You need $n^2-4m$ to be a perfect square, and the fraction to work out to a whole number. If $x$ is an integer, so is $y,$ since $n$ and $m$ have to be integers. (If $m$ and $m$ aren't integers, there's no possibility of integral solution.)



I overlooked the line beginning "So is there any exact way ..." before, and I'm afraid I don't understand what you mean.






share|cite|improve this answer











$endgroup$



Yes, you have two equations $$begin{align}x+y&=n\xy&=mend{align}$$ where $n$ and $m$ are known. From the first, $y=n-x$ Substitute this into the second, and use the quadratic formula to check if the solutions are integers.



EDIT
The substitution gives $$x^2-nx+m=0$$ By the quadratic formula, $$x={npmsqrt{n^2-4m}over2}$$ So now you can check if this is an integer. You need $n^2-4m$ to be a perfect square, and the fraction to work out to a whole number. If $x$ is an integer, so is $y,$ since $n$ and $m$ have to be integers. (If $m$ and $m$ aren't integers, there's no possibility of integral solution.)



I overlooked the line beginning "So is there any exact way ..." before, and I'm afraid I don't understand what you mean.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Jan 27 at 15:48

























answered Jan 27 at 15:09









saulspatzsaulspatz

17.2k31435




17.2k31435








  • 1




    $begingroup$
    Sorry, I didn't understand well. Did you mean checking that xy = x(x-n) = x^2-nx = m ? I think it is still the same.
    $endgroup$
    – anas pcpro
    Jan 27 at 15:39
















  • 1




    $begingroup$
    Sorry, I didn't understand well. Did you mean checking that xy = x(x-n) = x^2-nx = m ? I think it is still the same.
    $endgroup$
    – anas pcpro
    Jan 27 at 15:39










1




1




$begingroup$
Sorry, I didn't understand well. Did you mean checking that xy = x(x-n) = x^2-nx = m ? I think it is still the same.
$endgroup$
– anas pcpro
Jan 27 at 15:39






$begingroup$
Sorry, I didn't understand well. Did you mean checking that xy = x(x-n) = x^2-nx = m ? I think it is still the same.
$endgroup$
– anas pcpro
Jan 27 at 15:39













1












$begingroup$

Given a real value $t$, there is a well-known and widely used formula ${t}$, denoting the fractional part of $t$. Remark that $0le {t}le 1$ for each real $t$ and $t$ is integer if and only if ${t}=0$. Therefore, given real number $x$ and $y$ a formula



$${x}+{y}$$



equals to zero if and only if both $x$ and $y$ are integers.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you so much for this answer, but I can't find a way to simplify this and use it in equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:47










  • $begingroup$
    @anaspcpro Which operations you can use in equations?
    $endgroup$
    – Alex Ravsky
    Feb 2 at 13:48
















1












$begingroup$

Given a real value $t$, there is a well-known and widely used formula ${t}$, denoting the fractional part of $t$. Remark that $0le {t}le 1$ for each real $t$ and $t$ is integer if and only if ${t}=0$. Therefore, given real number $x$ and $y$ a formula



$${x}+{y}$$



equals to zero if and only if both $x$ and $y$ are integers.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you so much for this answer, but I can't find a way to simplify this and use it in equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:47










  • $begingroup$
    @anaspcpro Which operations you can use in equations?
    $endgroup$
    – Alex Ravsky
    Feb 2 at 13:48














1












1








1





$begingroup$

Given a real value $t$, there is a well-known and widely used formula ${t}$, denoting the fractional part of $t$. Remark that $0le {t}le 1$ for each real $t$ and $t$ is integer if and only if ${t}=0$. Therefore, given real number $x$ and $y$ a formula



$${x}+{y}$$



equals to zero if and only if both $x$ and $y$ are integers.






share|cite|improve this answer









$endgroup$



Given a real value $t$, there is a well-known and widely used formula ${t}$, denoting the fractional part of $t$. Remark that $0le {t}le 1$ for each real $t$ and $t$ is integer if and only if ${t}=0$. Therefore, given real number $x$ and $y$ a formula



$${x}+{y}$$



equals to zero if and only if both $x$ and $y$ are integers.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Feb 1 at 16:22









Alex RavskyAlex Ravsky

42.7k32383




42.7k32383












  • $begingroup$
    Thank you so much for this answer, but I can't find a way to simplify this and use it in equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:47










  • $begingroup$
    @anaspcpro Which operations you can use in equations?
    $endgroup$
    – Alex Ravsky
    Feb 2 at 13:48


















  • $begingroup$
    Thank you so much for this answer, but I can't find a way to simplify this and use it in equations.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:47










  • $begingroup$
    @anaspcpro Which operations you can use in equations?
    $endgroup$
    – Alex Ravsky
    Feb 2 at 13:48
















$begingroup$
Thank you so much for this answer, but I can't find a way to simplify this and use it in equations.
$endgroup$
– anas pcpro
Feb 2 at 13:47




$begingroup$
Thank you so much for this answer, but I can't find a way to simplify this and use it in equations.
$endgroup$
– anas pcpro
Feb 2 at 13:47












$begingroup$
@anaspcpro Which operations you can use in equations?
$endgroup$
– Alex Ravsky
Feb 2 at 13:48




$begingroup$
@anaspcpro Which operations you can use in equations?
$endgroup$
– Alex Ravsky
Feb 2 at 13:48











1












$begingroup$

The problem of any real number $x$ being an integer can be approached by using three functions.



1.) {$x$}, the fractional part of $x$

2.) $lfloor x rfloor$, the floor function of $x$ which returns the greatest integer less than or equal to $x$



3.) $lceil x rceil$, the ceiling function of $x$ which returns the least integer greater than or equal to $x$



As already explained by @Alex Ravsky about the fractional part, you can get to know individually whether $x$ and $y$ are separately integers or not.



$$Input(x) rightarrow boxed{left{xright}} rightarrow Output(y)$$
Here if $y$ = $0$, then the input is certainly an integer.



$Floor function$:
$$Input(x) rightarrow boxed{lfloor x rfloor} rightarrow Output(y)$$
Here the output $y$ is the greatest integer which is less than or equal to $x$
For e.x. if the input is $1.33$ he output will be the greatest integer which is less or equal $1.33$. Now the integers $-2, -1,0,1$ all are less than $1.33$ but the floor function will return $1$ since it is the greatest integer less or equal $1.33$.



$$Test: lfloor x rfloor =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$



Using programming you can run a loop which checks for all integers one by one and returns the (greatest)integer less or equal $x$.



$Ceiling Function:$
$$Input(x) rightarrow boxed{lceil x rceil} rightarrow Output(y)$$
Here the output $y$ will be the smallest integer greater than or equal to $x$. Lets say the input is $3.5$ then there are many integers greater than or equal to $3.5$. But we will choose the least integer which is $4$.



$$Test: lceil x rceil =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$
Using programming you can run a loop which checks for all integers one by one and returns the (least)integer greater or equal $x$.



The concept of any real number being an integer is simple. Any real number can be expressed in a decimal representation(recurring or non recurring). So we just need to truncate the fractional part of the real number to get the integer. These three functions help to truncate the fractional part so that we are left with an integer.



Finally each of these things can be checked using programming. Now every real decimal number is stored as a data type float. If you try to change your type to integer the decimal part is truncated.



int x =3.5;



will actually store only $3$ in the variable $x$. So you can also return an integer from a decimal value. In C programming storing a real value in integer type or just typecasting the real number to integer type will return you an integer.



Combining all this :
Checking $x$ and $y$ individually through both the floor and ceiling functions will tell you whether both of them are integers or not. No requirement to check whether the sum is an integer or the product is an integer or not.



Hope this helps.....






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you very much for all of this information, but I don't want to check them SEPARATELY, I want to check them both at the same time.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:42
















1












$begingroup$

The problem of any real number $x$ being an integer can be approached by using three functions.



1.) {$x$}, the fractional part of $x$

2.) $lfloor x rfloor$, the floor function of $x$ which returns the greatest integer less than or equal to $x$



3.) $lceil x rceil$, the ceiling function of $x$ which returns the least integer greater than or equal to $x$



As already explained by @Alex Ravsky about the fractional part, you can get to know individually whether $x$ and $y$ are separately integers or not.



$$Input(x) rightarrow boxed{left{xright}} rightarrow Output(y)$$
Here if $y$ = $0$, then the input is certainly an integer.



$Floor function$:
$$Input(x) rightarrow boxed{lfloor x rfloor} rightarrow Output(y)$$
Here the output $y$ is the greatest integer which is less than or equal to $x$
For e.x. if the input is $1.33$ he output will be the greatest integer which is less or equal $1.33$. Now the integers $-2, -1,0,1$ all are less than $1.33$ but the floor function will return $1$ since it is the greatest integer less or equal $1.33$.



$$Test: lfloor x rfloor =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$



Using programming you can run a loop which checks for all integers one by one and returns the (greatest)integer less or equal $x$.



$Ceiling Function:$
$$Input(x) rightarrow boxed{lceil x rceil} rightarrow Output(y)$$
Here the output $y$ will be the smallest integer greater than or equal to $x$. Lets say the input is $3.5$ then there are many integers greater than or equal to $3.5$. But we will choose the least integer which is $4$.



$$Test: lceil x rceil =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$
Using programming you can run a loop which checks for all integers one by one and returns the (least)integer greater or equal $x$.



The concept of any real number being an integer is simple. Any real number can be expressed in a decimal representation(recurring or non recurring). So we just need to truncate the fractional part of the real number to get the integer. These three functions help to truncate the fractional part so that we are left with an integer.



Finally each of these things can be checked using programming. Now every real decimal number is stored as a data type float. If you try to change your type to integer the decimal part is truncated.



int x =3.5;



will actually store only $3$ in the variable $x$. So you can also return an integer from a decimal value. In C programming storing a real value in integer type or just typecasting the real number to integer type will return you an integer.



Combining all this :
Checking $x$ and $y$ individually through both the floor and ceiling functions will tell you whether both of them are integers or not. No requirement to check whether the sum is an integer or the product is an integer or not.



Hope this helps.....






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you very much for all of this information, but I don't want to check them SEPARATELY, I want to check them both at the same time.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:42














1












1








1





$begingroup$

The problem of any real number $x$ being an integer can be approached by using three functions.



1.) {$x$}, the fractional part of $x$

2.) $lfloor x rfloor$, the floor function of $x$ which returns the greatest integer less than or equal to $x$



3.) $lceil x rceil$, the ceiling function of $x$ which returns the least integer greater than or equal to $x$



As already explained by @Alex Ravsky about the fractional part, you can get to know individually whether $x$ and $y$ are separately integers or not.



$$Input(x) rightarrow boxed{left{xright}} rightarrow Output(y)$$
Here if $y$ = $0$, then the input is certainly an integer.



$Floor function$:
$$Input(x) rightarrow boxed{lfloor x rfloor} rightarrow Output(y)$$
Here the output $y$ is the greatest integer which is less than or equal to $x$
For e.x. if the input is $1.33$ he output will be the greatest integer which is less or equal $1.33$. Now the integers $-2, -1,0,1$ all are less than $1.33$ but the floor function will return $1$ since it is the greatest integer less or equal $1.33$.



$$Test: lfloor x rfloor =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$



Using programming you can run a loop which checks for all integers one by one and returns the (greatest)integer less or equal $x$.



$Ceiling Function:$
$$Input(x) rightarrow boxed{lceil x rceil} rightarrow Output(y)$$
Here the output $y$ will be the smallest integer greater than or equal to $x$. Lets say the input is $3.5$ then there are many integers greater than or equal to $3.5$. But we will choose the least integer which is $4$.



$$Test: lceil x rceil =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$
Using programming you can run a loop which checks for all integers one by one and returns the (least)integer greater or equal $x$.



The concept of any real number being an integer is simple. Any real number can be expressed in a decimal representation(recurring or non recurring). So we just need to truncate the fractional part of the real number to get the integer. These three functions help to truncate the fractional part so that we are left with an integer.



Finally each of these things can be checked using programming. Now every real decimal number is stored as a data type float. If you try to change your type to integer the decimal part is truncated.



int x =3.5;



will actually store only $3$ in the variable $x$. So you can also return an integer from a decimal value. In C programming storing a real value in integer type or just typecasting the real number to integer type will return you an integer.



Combining all this :
Checking $x$ and $y$ individually through both the floor and ceiling functions will tell you whether both of them are integers or not. No requirement to check whether the sum is an integer or the product is an integer or not.



Hope this helps.....






share|cite|improve this answer









$endgroup$



The problem of any real number $x$ being an integer can be approached by using three functions.



1.) {$x$}, the fractional part of $x$

2.) $lfloor x rfloor$, the floor function of $x$ which returns the greatest integer less than or equal to $x$



3.) $lceil x rceil$, the ceiling function of $x$ which returns the least integer greater than or equal to $x$



As already explained by @Alex Ravsky about the fractional part, you can get to know individually whether $x$ and $y$ are separately integers or not.



$$Input(x) rightarrow boxed{left{xright}} rightarrow Output(y)$$
Here if $y$ = $0$, then the input is certainly an integer.



$Floor function$:
$$Input(x) rightarrow boxed{lfloor x rfloor} rightarrow Output(y)$$
Here the output $y$ is the greatest integer which is less than or equal to $x$
For e.x. if the input is $1.33$ he output will be the greatest integer which is less or equal $1.33$. Now the integers $-2, -1,0,1$ all are less than $1.33$ but the floor function will return $1$ since it is the greatest integer less or equal $1.33$.



$$Test: lfloor x rfloor =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$



Using programming you can run a loop which checks for all integers one by one and returns the (greatest)integer less or equal $x$.



$Ceiling Function:$
$$Input(x) rightarrow boxed{lceil x rceil} rightarrow Output(y)$$
Here the output $y$ will be the smallest integer greater than or equal to $x$. Lets say the input is $3.5$ then there are many integers greater than or equal to $3.5$. But we will choose the least integer which is $4$.



$$Test: lceil x rceil =x;$$
(Output of the function - Input to the function = $0$)
$$space thenspace xspace isspace anspace integer$$
Using programming you can run a loop which checks for all integers one by one and returns the (least)integer greater or equal $x$.



The concept of any real number being an integer is simple. Any real number can be expressed in a decimal representation(recurring or non recurring). So we just need to truncate the fractional part of the real number to get the integer. These three functions help to truncate the fractional part so that we are left with an integer.



Finally each of these things can be checked using programming. Now every real decimal number is stored as a data type float. If you try to change your type to integer the decimal part is truncated.



int x =3.5;



will actually store only $3$ in the variable $x$. So you can also return an integer from a decimal value. In C programming storing a real value in integer type or just typecasting the real number to integer type will return you an integer.



Combining all this :
Checking $x$ and $y$ individually through both the floor and ceiling functions will tell you whether both of them are integers or not. No requirement to check whether the sum is an integer or the product is an integer or not.



Hope this helps.....







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Feb 2 at 4:20









SNEHIL SANYALSNEHIL SANYAL

654110




654110












  • $begingroup$
    Thank you very much for all of this information, but I don't want to check them SEPARATELY, I want to check them both at the same time.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:42


















  • $begingroup$
    Thank you very much for all of this information, but I don't want to check them SEPARATELY, I want to check them both at the same time.
    $endgroup$
    – anas pcpro
    Feb 2 at 13:42
















$begingroup$
Thank you very much for all of this information, but I don't want to check them SEPARATELY, I want to check them both at the same time.
$endgroup$
– anas pcpro
Feb 2 at 13:42




$begingroup$
Thank you very much for all of this information, but I don't want to check them SEPARATELY, I want to check them both at the same time.
$endgroup$
– anas pcpro
Feb 2 at 13:42



Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

Npm cannot find a required file even through it is in the searched directory