summaryrefslogtreecommitdiff
path: root/euler301.c
diff options
context:
space:
mode:
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);
+}