This is an elegant problem...The idea is to find the Nth term in the series where n + R(n) is divisible by 13 and R(n) is the inverted number n. eg) 150 becomes 015.
The solution in C# is simple enough..if you think a little...
//Reversed Multiples
int cn = 0;
int lc = 0;
while (true)
{
lc += 1;
char[] a = lc.ToString().ToCharArray();
string xa = new string(a.Reverse().ToArray());
if (((lc + double.Parse(xa)) % 13) == 0)
{
cn += 1;
if (cn == 10000) break;
}
}
MessageBox.Show(lc.ToString());
The solution in C# is simple enough..if you think a little...
//Reversed Multiples
int cn = 0;
int lc = 0;
while (true)
{
lc += 1;
char[] a = lc.ToString().ToCharArray();
string xa = new string(a.Reverse().ToArray());
if (((lc + double.Parse(xa)) % 13) == 0)
{
cn += 1;
if (cn == 10000) break;
}
}
MessageBox.Show(lc.ToString());
Comments