-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathid0055.c
More file actions
43 lines (33 loc) · 664 Bytes
/
id0055.c
File metadata and controls
43 lines (33 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Licensed under the MIT License.
// Lychrel Numbers
#include "../lib/euler.h"
static bool math_is_pseudo_lychrel(long long n)
{
for (int i = 0; i < 50; i++)
{
if (n < 0)
{
return true;
}
long long reversed = math_reverse(n);
n += reversed;
if (math_is_palindrome(n))
{
return false;
}
}
return true;
}
int main(void)
{
int count = 0;
clock_t start = clock();
for (int i = 0; i < 10000; i++)
{
if (math_is_pseudo_lychrel(i))
{
count++;
}
}
return euler_submit(55, count, start);
}