Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static BigInteger Palindrome(bool isEven, BigInteger[] i)
- {
- BigInteger x, y, a = 0;
- string s = a.ToString();
- if (isEven)
- {
- for (x = i[0]; x > 0; x--)
- {
- x--;
- if ((x * i[1]) < a) return a;
- for (y = i[1]; y > 0; y--)
- {
- if (x * y < a) y = 0;
- s = (x * y).ToString();
- if (s.SequenceEqual(s.Reverse()) && BigInteger.Parse(s) > a)
- {
- //Console.WriteLine("Even: {0} * {1} = {2}", x, y, s);
- a = BigInteger.Parse(s);
- y = 0;
- }
- }
- }
- }
- else
- {
- for (x = i[0]; x > 0; x--)
- {
- if ((x * i[1]) < a) return a;
- for (y = i[1]; y > 0; y--)
- {
- if (x * y < a) y = 0;
- s = (x * y).ToString();
- if (s.SequenceEqual(s.Reverse()) && BigInteger.Parse(s) > a)
- {
- //Console.WriteLine("Uneven: {0} * {1} = {2}", x, y, s);
- a = BigInteger.Parse(s);
- y = 0;
- }
- }
- x--;
- }
- }
- return a;
- }
Advertisement
Add Comment
Please, Sign In to add comment