Find all positive pairs of integers that give a product of -15
Answers
Answer:
How do I find all pairs of integers whose product is less than equal to a particular number?
What is the best mobile football game with many leagues and competitions?
If you like manager game, you can try Virtuafoot Manager (game I created). Virtuafoot Manager - The football manager game This game
Let's say we want to find all pairs P=(x,y) where the x∗y≤N .
What I would do is start from x=2 , and go on till N2 and for each x, I would count pairs till N where x∗y≤N .
int count = 1;
vector< pair< int, int > > pairs;
pairs.push_back(1,N);
for(int x = 2; x <= N / 2; x++)
{
for(int y = 2; x*y <= N; y++)
{
pairs.push_back(make_pair(x,y));
count++;
}
}
This is obviously an O(n2) and these pairs are unordered. (x,y) and (y,x) are treated same.
If negative integers are also covered, then each pair would be inserted again both the numbers being negative.
If you just want to count number of integer pairs with product less than or equal to N .
I guess following approximation would work.
If xy≤N⟹y=⌊Nx⌋ ,
If we calculate summation for x→1…N . It would count all the pairs but they will be ordered pairs (x,y) would be counted twice but all the pairs where x and y are equal would be counted as 1 .
To add the number where x=y back in, we add the number of pairs (x,x) where x2≤N which is N−−√ . Now that all pairs are counted twice, we divide by 2 .
Count(n)=12(⌊N−−√⌋+∑Nk=1⌊Nk⌋)
I hope that helps.
Step-by-step explanation:
please mark as brainliest answer and follow me friend
Answer:
There is no positive pair of integers that gives a product of -15. Because as it is a negative number then there must be a positive and a negative integer. Like (-3) and 5 or (-5) or 3
Step-by-step explanation:
Hope it helps you ☺️☺️☺️