4.
Here is how I determine a number isn't prime.
for (NumericalDataType a = 3; a < numberThatIDontWantToFigureOutInMyHead; a++){
for (NumericalDataType b = 0; b < numberInTheQuestion; b++){
/*
*insert code that involves adds the sum of these numbers to some list as they are not prime (think about it if you don't believe me)
*/
}
}
the answer is 123456789109 - the length of the list of numbers that are not prime determined from that - (log(123456789109) / log(2)) - 1
or something along those lines. I don't feel like creating the objects I would need to be able to get an actual answer at the moment since I already had to do something similar for a different problem a couple days ago, but this should work.
5. instead of x and y, let's use a and b where a is the smaller integer
because of obviousness, b%a=0, so the closest they can be, which is important since we're dealing with power functions, would mean b = 2*a
f(a) = a ^ (2 * a)
g(a) = (2 * a) ^ a
the value for a at which g(a) = f(a) will allow you to get values for x and y such that x^y = y^x where x and y are integers.
these functions intersect at one point and that one point is (2, 4), meaning the only times when x^y = y^x is when x is 2 and y is 4 and when x is 4 and y is 2.