```python
from sympy import *
from sympy.utilities.lambdify import lambdify, implemented_function
from functools import lru_cache
import sys
import math
init_printing()
n = symbols('n',integer=True)

```


```python
initial_positive_conditions = {0:0, 1:1, 2:1}


def makePositiveTribonacci(maxsize = None):
    @lru_cache(maxsize)
    def calcPositiveTribonacci(n):
        return calcPositiveTribonacci(n-1)  + calcPositiveTribonacci(n-2) + calcPositiveTribonacci(n-3) if n not in initial_positive_conditions else initial_positive_conditions[n]
    return calcPositiveTribonacci

positiveTribonacci = makePositiveTribonacci(None)
PT = implemented_function(Function('T'), positiveTribonacci)

```


```python
initial_negative_conditions = {0:0, -1:0, -2:1}
def makeNegativeTribonacci(maxsize=None):
    @lru_cache(maxsize=maxsize)
    def calcNegativeTribonacci(n):
        return calcNegativeTribonacci(n+3)  - calcNegativeTribonacci(n+2) - calcNegativeTribonacci(n+1) if n not in initial_negative_conditions else initial_negative_conditions[n]
    return calcNegativeTribonacci
negativeTribonacci = makeNegativeTribonacci(maxsize = None)
NT = implemented_function(Function('NT'), negativeTribonacci)
lambda_negative_tribonacci = lambdify(n, NT(n))
[(n*-1, lambda_negative_tribonacci(n*-1)) for n in range (0,11)]
```


```python
def tribonacci(n):
    if n>=0:
        return positiveTribonacci(n)
    elif n<0:
        return negativeTribonacci(n)
T = implemented_function(Function('T'), tribonacci)
lambda_tribonacci = lambdify(n, T(n))
[(n, lambda_tribonacci(n)) for n in range(-40, 40)]
```


```python
limit = 8
k = symbols('k', integer = True)
q = Product(T(k), (k,n,limit))
p = Sum(q/T(k), (k,n,limit))
t = T(n)-T(n-1)+1
calc_t = Lambda([n], t.doit()) 
calc_p = Lambda([n], p.doit())
calc_q = Lambda([n], q.doit())
calc_expression = Lambda([n], ((t.doit() * p.doit())-q.doit()).doit())
print(type(N(calc_expression(36), 0)))
(int(calc_t(36).evalf())*int(calc_p(36).evalf())-int(calc_q(36).evalf()))
```


```python

```


```python

```


```python

```


```python

```


```python

```


```python

```


```python

```


```python

```

9a04cac71c162af5ecc635570db9d6032b2e40aa
ipynb
Jupyter Notebook
TEST.ipynb
iskorini/PAA-Project
ca62694d1d631f44dd8752b941cbac3451ad842a
Apache-2.0
TEST.ipynb
iskorini/PAA-Project
ca62694d1d631f44dd8752b941cbac3451ad842a
Apache-2.0
TEST.ipynb
iskorini/PAA-Project
ca62694d1d631f44dd8752b941cbac3451ad842a
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES