summaryrefslogtreecommitdiff
path: root/euler301.c
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-06-02 11:16:00 +0800
committerIru Cai <mytbk920423@gmail.com>2018-06-02 11:16:00 +0800
commit90ab4dafa14d811ed0d7d1466675a69036be5392 (patch)
tree8dca59f993caaaa73ecc31ac02ca478b9c7291b8 /euler301.c
parentf54a9727f09e0ffe52f4123ed3f9e0cd67ddcff9 (diff)
downloadproject_euler-90ab4dafa14d811ed0d7d1466675a69036be5392.tar.xz
301,381
Diffstat (limited to 'euler301.c')
-rw-r--r--euler301.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/euler301.c b/euler301.c
new file mode 100644
index 0000000..2f05108
--- /dev/null
+++ b/euler301.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdint.h>
+
+int main()
+{
+ uint64_t n = 0, n2 = 0, n3 = 0;
+ int count = 0;
+
+ for (n = 1; n <= (1<<30); n++) {
+ n2 = n * 2;
+ n3 = n * 3;
+ if ((n^n2^n3) == 0)
+ count++;
+ }
+ printf("%d\n", count);
+}