Generated by Cython 0.13 on Wed Apr 20 21:24:14 2011

Raw output: _Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.c

 1: 
 2: include "interrupt.pxi"  # ctrl-c interrupt block support
  /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":2
 * 
 * include "interrupt.pxi"  # ctrl-c interrupt block support             # <<<<<<<<<<<<<<
 * include "stdsage.pxi"  # ctrl-c interrupt block support
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 3: include "stdsage.pxi"  # ctrl-c interrupt block support
 4: 
 5: include "cdefs.pxi"
 6: cdef extern from "math.h":
 7:     double floor(double x)
 8: 
 9: def primeish(int n):
/* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":9
 *     double floor(double x)
 * 
 * def primeish(int n):             # <<<<<<<<<<<<<<
 *     cdef int result
 *     if n==1:
 */

static PyObject *__pyx_pf_86_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0_primeish(PyObject *__pyx_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_86_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0_primeish[] = "File: _Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx (starting at line 9)";
static PyObject *__pyx_pf_86_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0_primeish(PyObject *__pyx_self, PyObject *__pyx_arg_n) {
  int __pyx_v_n;
  int __pyx_v_result;
  PyObject *__pyx_v_fact;
  PyObject *__pyx_v_j;
  PyObject *__pyx_v_t;
  PyObject *__pyx_v_next;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("primeish");
  __pyx_self = __pyx_self;
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_AsInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.primeish");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_fact = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_j = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_next = Py_None; __Pyx_INCREF(Py_None);
 10:     cdef int result
 11:     if n==1:
  /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":11
 * def primeish(int n):
 *     cdef int result
 *     if n==1:             # <<<<<<<<<<<<<<
 *         result = 0
 *         return result
 */
  switch (__pyx_v_n) {
    case 1:
 12:         result = 0
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":12
 *     cdef int result
 *     if n==1:
 *         result = 0             # <<<<<<<<<<<<<<
 *         return result
 *     elif n==2:
 */
    __pyx_v_result = 0;
 13:         return result
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":13
 *     if n==1:
 *         result = 0
 *         return result             # <<<<<<<<<<<<<<
 *     elif n==2:
 *         result = 1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
 14:     elif n==2:
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":14
 *         result = 0
 *         return result
 *     elif n==2:             # <<<<<<<<<<<<<<
 *         result = 1
 *         return result
 */
    case 2:
 15:         result = 1
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":15
 *         return result
 *     elif n==2:
 *         result = 1             # <<<<<<<<<<<<<<
 *         return result
 *     elif n==3:
 */
    __pyx_v_result = 1;
 16:         return result
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":16
 *     elif n==2:
 *         result = 1
 *         return result             # <<<<<<<<<<<<<<
 *     elif n==3:
 *         result = 2
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
 17:     elif n==3:
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":17
 *         result = 1
 *         return result
 *     elif n==3:             # <<<<<<<<<<<<<<
 *         result = 2
 *         return result
 */
    case 3:
 18:         result = 2
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":18
 *         return result
 *     elif n==3:
 *         result = 2             # <<<<<<<<<<<<<<
 *         return result
 *     else:
 */
    __pyx_v_result = 2;
 19:         return result
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":19
 *     elif n==3:
 *         result = 2
 *         return result             # <<<<<<<<<<<<<<
 *     else:
 *         result = -1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
    default:
 20:     else:
 21:         result = -1
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":21
 *         return result
 *     else:
 *         result = -1             # <<<<<<<<<<<<<<
 *         fact = 1
 *         for j in range(3,n+1):
 */
    __pyx_v_result = -1;
 22:         fact = 1
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":22
 *     else:
 *         result = -1
 *         fact = 1             # <<<<<<<<<<<<<<
 *         for j in range(3,n+1):
 *             fact = fact*(j-2)
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF(__pyx_v_fact);
    __pyx_v_fact = __pyx_int_1;
 23:         for j in range(3,n+1):
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":23
 *         result = -1
 *         fact = 1
 *         for j in range(3,n+1):             # <<<<<<<<<<<<<<
 *             fact = fact*(j-2)
 *             t = fact/j
 */
    __pyx_t_1 = PyInt_FromLong((__pyx_v_n + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
    __Pyx_GIVEREF(__pyx_int_3);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3);
    } else {
      __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
      } else {
        __pyx_t_1 = PyIter_Next(__pyx_t_3);
        if (!__pyx_t_1) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_v_j);
      __pyx_v_j = __pyx_t_1;
      __pyx_t_1 = 0;
 24:             fact = fact*(j-2)
      /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":24
 *         fact = 1
 *         for j in range(3,n+1):
 *             fact = fact*(j-2)             # <<<<<<<<<<<<<<
 *             t = fact/j
 *             next = (fact - j*floor(fact/j))
 */
      __pyx_t_1 = PyNumber_Subtract(__pyx_v_j, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Multiply(__pyx_v_fact, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_fact);
      __pyx_v_fact = __pyx_t_4;
      __pyx_t_4 = 0;
 25:             t = fact/j
      /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":25
 *         for j in range(3,n+1):
 *             fact = fact*(j-2)
 *             t = fact/j             # <<<<<<<<<<<<<<
 *             next = (fact - j*floor(fact/j))
 *             result += next
 */
      __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_fact, __pyx_v_j); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_4;
      __pyx_t_4 = 0;
 26:             next = (fact - j*floor(fact/j))
      /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":26
 *             fact = fact*(j-2)
 *             t = fact/j
 *             next = (fact - j*floor(fact/j))             # <<<<<<<<<<<<<<
 *             result += next
 *         return result
 */
      __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_fact, __pyx_v_j); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(floor(__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Multiply(__pyx_v_j, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Subtract(__pyx_v_fact, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_next);
      __pyx_v_next = __pyx_t_4;
      __pyx_t_4 = 0;
 27:             result += next
      /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":27
 *             t = fact/j
 *             next = (fact - j*floor(fact/j))
 *             result += next             # <<<<<<<<<<<<<<
 *         return result
 */
      __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_next); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_result += __pyx_t_6;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 28:         return result
    /* "/Users/karl-dietercrisman/.sage/temp/new_host_2.home/72755/spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx/_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.pyx":28
 *             next = (fact - j*floor(fact/j))
 *             result += next
 *         return result             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_Users_karl_dietercrisman__sage_sage_notebook_sagenb_home_admin_162_code_sage49_spyx_0.primeish");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_fact);
  __Pyx_DECREF(__pyx_v_j);
  __Pyx_DECREF(__pyx_v_t);
  __Pyx_DECREF(__pyx_v_next);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}