Skip to content

Instantly share code, notes, and snippets.

View OussaZaki's full-sized avatar
🧪
Experimenting

Oussama Zaki OussaZaki

🧪
Experimenting
View GitHub Profile
const port = 3000
require('http')
.createServer((req, res) => {
console.log('url:', req.url)
res.end('hello smartcoding')
})
.listen(port, (error)=>{
console.log(`server is running on ${port}`)
})
@OussaZaki
OussaZaki / euler3_1.py
Last active May 13, 2019 16:23
Refined Eratosthenes sieve factorisation
#!/bin/python3
import math
def max_prime_factor(n):
maxPrime = -1
# We keep dividing n by 2 to get rid of all the even composite factors.
while n % 2 == 0:
maxPrime = 2
n >>= 1 # equivalent to n //= 2
@OussaZaki
OussaZaki / euler3_2.py
Created May 13, 2019 16:56
Pollard's rho factorisation
#!/bin/python3
def is_prime(n):
if n < 2:
return False
ps = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
def is_spsp(n, a):
d, s = n-1, 0