# Path: mom/_prime_sieve.py
# def make_prime_sieve(max_n):  # def _numpy_primesfrom2to(max_n):
#   """Input n>=6, Returns a array of primes, 2 <= p < n"""
#   sieve = np.ones(max_n // 3 + (max_n % 6 == 2), dtype=np.bool)
#   sieve[0] = False
#   for i in _compat.range(int(max_n ** 0.5) // 3 + 1):
#     if sieve[i]:
#       k = 3 * i + 1 | 1
#       sieve[((k * k) // 3)::2 * k] = False
#       sieve[(k * k + 4 * k - 2 * k * (i & 1)) // 3::2 * k] = False
#   return np.r_[2, 3, ((3 * np.nonzero(sieve)[0] + 1) | 1)]


import sys
import os
from mom._prime_sieve import make_prime_sieve
from pprint import pprint

sys.path[0:0] = [
  os.curdir,
  ]


header = '''\
#/usr/bin/env python
# -*- coding: utf-8 -*-
# Automatically-generated by dump_primes.py
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Precomputed prime sieve for faster lookups."""

'''
print(header)


# Path: mom/_prime_sieve.py
# def make_prime_sieve(max_n):  # def _numpy_primesfrom2to(max_n):
#   """Input n>=6, Returns a array of primes, 2 <= p < n"""
#   sieve = np.ones(max_n // 3 + (max_n % 6 == 2), dtype=np.bool)
#   sieve[0] = False
#   for i in _compat.range(int(max_n ** 0.5) // 3 + 1):
#     if sieve[i]:
#       k = 3 * i + 1 | 1
#       sieve[((k * k) // 3)::2 * k] = False
#       sieve[(k * k + 4 * k - 2 * k * (i & 1)) // 3::2 * k] = False
#   return np.r_[2, 3, ((3 * np.nonzero(sieve)[0] + 1) | 1)]


# Path: tools/dump_primes.py
import sys
import os
from mom._prime_sieve import make_prime_sieve
from pprint import pprint


sys.path[0:0] = [
  os.curdir,
  ]


header = '''\
#/usr/bin/env python
# -*- coding: utf-8 -*-
# Automatically-generated by dump_primes.py
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Precomputed prime sieve for faster lookups."""

'''
print(header)


a = set(make_prime_sieve(9999))