I'm trying to convert this for loop :
for (int i = 100; i < 1000; i++)
{
for (int j = 100; j < 1000; j++)
{
if (IsPalindrome(i * j))
{
palindromes.Add(i * j);
}
}
}
// For some reason the list is not sorted correctly, but when sorted it works.
palindromes.Sort();
Console.WriteLine(palindromes.Last());
Into a single LINQ statement, I'm messing up with the multiplications though, this is what I have so far, unfortunately it doesn't seem to increment correctly resulting in the wrong collection of numbers.
var palis = Enumerable.Range(100, 999)
.Select(n => n * Enumerable.Range(100, 999)
.Aggregate((ctr, num) => ctr++))
.Where(n => IsPalindrome(n)).Max();