写一个python函数,该函数是: f(1) =1 f(2) =2 f(n) =3*f(n-1) +2*f(n-2) 输出f(n的最后3个数字 (或如果f(n小于100的所有数字) 转换为整数 (即删除所有不必要的前0).
Here's a Python function that implements the formula for f(n) and outputs the last 3 digits (or all digits if f(n) is less than 100) converted to an integer:

```python
def f(n):
    if n == 1:
        return 1
    elif n == 2:
        return 2
    else:
        fn_1 = f(n-1)
        fn_2 = f(n-2)
        fn = 3*fn_1 + 2*fn_2
        if fn < 100:
            return fn
        else:
            return int(str(fn)[-3:])
```