Skip to content

Instantly share code, notes, and snippets.

Time Awake Since Boot: 1600 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
@jzau
jzau / prime.cpp
Created October 24, 2013 13:31
print all prime number which less than N using c++
#include<iostream>
#include<cmath>
#define N 200000
using namespace std;
bool prime[N];
int main()
{
int i, j;
prime[0] = prime[1] = false;
prime[2] = true;
@jzau
jzau / prime.py
Last active December 26, 2015 10:29
print all prime which less than N using python
import math
N = 200000
M = int(math.sqrt(N)) + 1;
a = [1]*N
for i in range(3, M, 2):
for j in range(i+i, N, i):
a[j]=0