summaryrefslogtreecommitdiff
path: root/2017/23-prog.txt
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-12-23 10:55:40 +0100
committertomsmeding <tom.smeding@gmail.com>2017-12-23 10:55:57 +0100
commit695ebdc358096146b7d2594aa252c02027c9dc3f (patch)
tree8760d6c5ccfb99c13f74d525cc4d282c579c355b /2017/23-prog.txt
parent0ac0ecf13c7793fb6589d2150a17115d990035fa (diff)
Day 23
Nice one, having to actually look at the input for once. :)
Diffstat (limited to '2017/23-prog.txt')
-rw-r--r--2017/23-prog.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/2017/23-prog.txt b/2017/23-prog.txt
new file mode 100644
index 0000000..7fbc42a
--- /dev/null
+++ b/2017/23-prog.txt
@@ -0,0 +1,13 @@
+for (b = 106700; b != 123700; b += 17) {
+ f = 1; // is b prime?
+
+ for (d = 2; d != b; d++) {
+ for (e = 2; e != b; e++) {
+ if (d * e == b) f = 0; // nope, it's d * e
+ }
+ }
+
+ if (f == 0) h++;
+}
+
+// h = numprimes([106700, 106717 ... 123700])