def element(cls, n, unbound=False):
        """returns value for element N in the series"""
        #assert type(n) is IntType

        inRange(n, 46, unbound)

        return cls._h.element(n)
    def elementIt(cls, n, unbound=False):
        inRange(n, 46, unbound)
        return cls._h.elementIt(n)

        # ##@class A005248
        # #sequence [A005248](https://oeis.org/A005248)
        # #
        # class A005248:
        # @classmethod
        # def element(cls, n, unbound = False):
        # return Lucas.element(2 * n)

        # @classmethod
        # def elementIt(cls, n, unbound = False):
        # return cls._h.elementIt(2 * n)

        # ##@class A002878
        # #sequence [A002878](https://oeis.org/A002878)
        # #
        # class A002878:
        # @classmethod
        # def element(cls, n, unbound = False):
        # return Lucas.element(2 * n + 1)

        # @classmethod
        # def elementIt(cls, n, unbound = False):
        # return Lucas.elementIt(2 * n + 1)

        # ##@class A240926
        # #sequence [A240926](https://oeis.org/A240926)
        # #
        #class A240926(Base):
        """a(n) = 2 + L(2*n)"""
    def element(cls, n, unbound=False):
        inRange(n, 9, unbound)

        if n == 0:
            return 1
        elif n == 1:
            return 7

        return 6 * cls.element(n - 1) - cls.element(n - 2)
    def element(cls, N, unbound=False):
        inRange(N, 249, unbound)  #recursive type context too complex for C(++)

        if N == 0:
            return 1

        f = cls.element(N - 1)

        return N - Male.element(f)
    def element(cls, N, unbound=False):
        inRange(N, 249, unbound)

        if N == 0:
            return 0

        m = cls.element(N - 1)

        return N - Female.element(m)
Beispiel #6
0
    def element(cls, n, unbound=False):
        """recursive function which returns the value of !n"""
        #assert type(n) is IntType, 'arg n must be a non-negative integer value'

        inRange(n, 20, unbound)

        if n == 0 or n == 1:
            return 1

        return n * cls.element(n - 1)
    def element(cls, N, unbound=False):
        inRange(N, 251, unbound)

        if N == 1 or N == 2:
            return 1

        next = cls.element(N - 1)
        n2Val = cls.element(N - 2)

        return cls.element(next) + cls.element(N - n2Val - 1)
    def element(cls, N, unbound=False):
        #f(N) = N - h(h(h(N-1)))
        inRange(N, 166, unbound)

        if N == 0:
            return 0

        val = cls.element(N - 1)
        h0 = cls.element(val)

        return N - cls.element(h0)
    def element(cls, N, unbound=False):
        #static_assert(N <= 249, "");
        inRange(
            N, 249, unbound
        )  #recursive type context too complex in C, could potentially blow stack

        if N == 0:
            return 0

        val = cls.element(N - 1)

        return N - cls.element(val)
Beispiel #10
0
    def elementIt(cls, n, unbound=False):
        """iterative function which returns the value of !n"""
        #assert type(n) is IntType, 'arg n must be a non-negative integer value'
        inRange(n, 20, unbound)

        if n == 0 or n == 1:
            return 1

        ret = 2

        for i in range(2, n):
            #print(ret)
            #print(i)
            ret *= (i + 1)

        return ret

    #class Prime

    #@class Double
    #double factorial N!!, series [A006882](https://oeis.org/A006882)
    #
    #class Double:
    # @classmethod
    # def elementIt(cls, n, unbound = False):
    #inRange(n, 16)
    #return Factorial.element(Factorial.element(n))

    # @classmethod
    # def elementIt(cls, n, unbound = False):
    #inRange(n, 16)
    #return Factorial.elementIt(factorial.elementIt(n))


#def _set(n):
#    """arg n: number of elemenets in the sequence
#    lists can have repeated values however,
#    sets only contain unique sequences of values
#    therefor it is convenient to construct sets aswell
#    for additional functionality"""

#    return set(_list(n))     #[f for f in genFib(n)])
##
#def _frozenSet(n):
#    return frozenset(_list(n))
 def element(cls, n, unbound=False):
     inRange(n, 46, unbound)
     return cls._h.element(n)
    def element(cls, n, unbound=False):
        #assert type(n) is IntType

        inRange(n, 33, unbound)
        return cls._h.element(n)
 def elementIt(cls, n, unbound=False):
     inRange(n, 24, unbound)
     f = Fibonacci.elementIt(n)
     return f * f