In the range [1 - 100], find the number, or numbers, that have the maximum number of divisors.

Example:

-Divisors of 5 are: 1-5. The number of divisors is 2.

-Divisors of 6 are: 1-2-3-6. The number of divisors is 4.

Then 6 is the number that has the maximum number of divisors. ]]>

I know the lengths of all 3 sides of the triangle:

Code:

`sideLength1 = Math.Sqrt(Math.Pow((Right.X - Middle.X), 2) + Math.Pow((Right.Y - Middle.Y), 2)); //length from bottom right length to paddle`

sideLength2 = Math.Sqrt(Math.Pow((e.X - Middle.X), 2) + Math.Pow((e.Y - Middle.Y), 2)); //length from paddle to mouse point

sideLength3 = Math.Sqrt(Math.Pow((Right.X - e.X), 2) + Math.Pow((Right.Y - e.Y), 2)); //length from mouse point to bottom right

The middle point of the red rectangle only ever changes via its x-axis. The right bottom point against the yellow line will never change. I am looking to get the angle against the middle of the red rectangle, in every scenario. The top points of the pink lines will be from a mouse click, and since those vary, the lengths of the sides will vary. But, I calculated the side lengths above and debugged those as correct.

The reason for the test of the largest side is because of the law of cosines (I think). If the 3rd side is the longest, then the calculated angle is obviously the one against the middle of the red rectangle. However, in debugging, I've come across angle values calculated at 2 and 0 with only so much as adding a couple of parentheses.

Code:

`if (sideLength1 > sideLength2 && sideLength1 > sideLength3)`

largestSide = 1;

else if (sideLength2 > sideLength1 && sideLength2 > sideLength3)

largestSide = 2;

else

largestSide = 3;

if (largestSide == 1)

{

largestAngle = (int)Math.Acos((Math.Pow(sideLength1, 2) - (Math.Pow(sideLength2, 2) + Math.Pow(sideLength3, 2))) / (2 * sideLength2 * sideLength3));

}

else if (largestSide == 2)

{

largestAngle = (int)Math.Acos((Math.Pow(sideLength2, 2) - (Math.Pow(sideLength1, 2) + Math.Pow(sideLength3, 2))) / (2 * sideLength1 * sideLength3));

}

else

{

largestAngle = (int)Math.Acos((Math.Pow(sideLength3, 2) - (Math.Pow(sideLength1, 2) + Math.Pow(sideLength2, 2))) / (2 * sideLength1 * sideLength2));

}

if (largestSide == 3)

{

b.Angle = largestAngle;

return;

}

but if the characters are: R, G, B, Y, R, the maximum is 60, but I can't work out a formula. also six characters R, G, B, Y, R, G, the maximum is 180...

there must be a simple formula for calculating those numbers. can anyone help with this?

This works really well for me. Its simple and makes certain calculations like plotting an intercept course quite easy. But I've always been curious: Is there anyway to convert this to an angle. How can I convert (5,5) to 45 degrees or 315 depending on how you want to interpret the angles.

I forgot to mention that the signs of the numbers in the vector represents the direction on the specific axis. So a vector of say (12,3) represents movement in a downward right direction. (-12,3) is downward left. (-12,-3) is upward left. (12,-3) is upward right. The absolute value of the larger number is what I use to represent speed. But for the purposes of converting to an angle, speed is not important. ]]>