From c795373af58c0db2c8c81f4a234cc649cd4118e5 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 10 Feb 2016 11:15:30 +0200
Subject: [PATCH] Added special cases for Python3, Python, PyPy and LuaJIT.

---
 Makefile | 5 ++++-
 prime.py | 8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index cc0bb67..a216e69 100644
--- a/Makefile
+++ b/Makefile
@@ -18,8 +18,11 @@ clean:
 
 test: all
 	@ time -f "%C : %E seconds" ./a.out $(ROUNDS) > /dev/null
-	@ [ -n "$$(which python3)" ] && time -f "%C : %E seconds" ./prime.py $(ROUNDS) > /dev/null
+	@ [ -n "$$(which python)" ] && time -f "%C : %E seconds" ./prime.py $(ROUNDS) > /dev/null
+	@ [ -n "$$(which python3)" ] && time -f "%C : %E seconds" python3 prime.py $(ROUNDS) > /dev/null
+	@ [ -n "$$(which pypy)" ] && time -f "%C : %E seconds" pypy  prime.py $(ROUNDS) > /dev/null
 	@ [ -n "$$(which lua)" ] && time -f "%C : %E seconds" ./prime.lua $(ROUNDS) > /dev/null
+	@ [ -n "$$(which luajit)" ] && time -f "%C : %E seconds" luajit prime.lua $(ROUNDS) > /dev/null
 	@ [ -n "$$(which php)" ] && time -f "%C : %E seconds" ./prime.php $(ROUNDS) > /dev/null
 	@ [ -n "$$(which php7.0)" ] && time -f "%C : %E seconds" php7.0 prime.php $(ROUNDS) > /dev/null
 	@ [ -n "$$(which ruby)" ] && time -f "%C : %E seconds" ./prime.rb $(ROUNDS) > /dev/null
diff --git a/prime.py b/prime.py
index 004ffa2..78fbf9b 100755
--- a/prime.py
+++ b/prime.py
@@ -1,9 +1,13 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
+from __future__ import (absolute_import, division,
+                        print_function, unicode_literals)
+
+
 def is_prime(x):
     from math import sqrt, ceil
     if sqrt(x).is_integer():
         return False
-    for i in range(2, ceil(sqrt(x))):
+    for i in range(2, int(ceil(sqrt(x)))):
         if x % i == 0:
             return False
     return True
-- 
GitLab