OFFSET
0,3
FORMULA
a(n) = f^n(n) where f(n) = floor((3*n - 1)/2) = A001651(n).
EXAMPLE
a(0) = f^0 (0) = 0 (f not applied at all);
a(1) = f^1 (1) = f(1) = floor((3*1 - 1)/2) = 1;
a(2) = f^2 (2) = f(f(2)) = floor((3*f(2) - 1)/2) = floor((3*floor((3*2 - 1)/2) - 1)/2) = 2.
MAPLE
a:= n-> (f-> (f@@n)(n))(t-> floor((3*t-1)/2)):
seq(a(n), n=0..20);
PROG
(C++)
#include <iostream>
using namespace std;
// Think of unsigned int as a natural number
unsigned int f(unsigned int n) {
return (3*n - 1)/2;
}
unsigned int a(unsigned int pow, unsigned int n) {
if (pow == 0) return n;
else return a(pow-1, f(n));
}
int main() {
for (unsigned int n(0); n <= 20; ++n)
cout << a(n, n) << " ";
return 0;
}
(Python)
def f(n):
return (3*n - 1)//2;
def a(pow, n):
if (pow == 0): return n;
else: return a(pow-1, f(n));
l = [a(n, n) for n in range(21)];
(Python)
from functools import reduce
def A353215(n): return reduce(lambda x, _ : (3*x-1)//2, range(n), n) # Chai Wah Wu, May 07 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Yves Daaboul, May 01 2022
STATUS
approved