Skip to content

Instantly share code, notes, and snippets.

View cclinet's full-sized avatar

cclin cclinet

  • Mars
View GitHub Profile
import numpy as np
def prs(n):
"""Input n>=6, Returns an array of primes, 2 <= p < n"""
sieve = np.ones(n // 3 + (n % 6 == 2), dtype=np.bool_)
sieve[0] = False
for i in range(int(n**0.5) // 3 + 1):
if sieve[i]:
k = 3 * i + 1 | 1
@cclinet
cclinet / regret_matching.py
Created December 16, 2020 10:57 — forked from namoshizun/regret_matching.py
Use regret matching to play rock-paper-scissors
from __future__ import division
from random import random
import numpy as np
import pandas as pd
"""
Use regret-matching algorithm to play Scissors-Rock-Paper.
"""