# [seqfan] Re: Wavy Simple Recursion Involving Minimum

Alois Heinz heinz at hs-heilbronn.de
Wed Jul 29 15:17:10 CEST 2009

```gf is:

x*(3*x^13+3*x^12-3*x^10-4*x^9-3*x^8-x^7+x^6+2*x^5+x^4-x^3-2*x^2-2*x-1)
----------------------------------------------------------------------
(3*x^15-1)

formula:

a(n) = 3^floor(n/15) * { 0,  if n mod 15 is 0 }
{ 1,        "        1 }
{ 2,        "        2 }
{ 2,        "        3 }
{ 1,        "        4 }
{ -1,       "        5 }
{ -2,       "        6 }
{ -1,       "        7 }
{ 1,        "        8 }
{ 3,        "        9 }
{ 4,        "       10 }
{ 3,        "       11 }
{ 0,        "       12 }
{-3,        "       13 }
{-3,        "       14 }

maple program:

a:= proc(n) local m, r;
m:= iquo (n,15,'r');
3^m * [0, 1, 2, 2, 1, -1, -2, -1, 1, 3, 4, 3, 0, -3, -3][r+1]
end;
seq (a(n), n=0..100);

gives

0, 1, 2, 2, 1, -1, -2, -1, 1, 3, 4, 3, 0, -3, -3, 0, 3, 6, 6, 3, -3, -6,
-3, 3,
9, 12, 9, 0, -9, -9, 0, 9, 18, 18, 9, -9, -18, -9, 9, 27, 36, 27, 0,
-27, -27,
0, 27, 54, 54, 27, -27, -54, -27, 27, 81, 108, 81, 0, -81, -81, 0, 81,
162, 162,
81, -81, -162, -81, 81, 243, 324, 243, 0, -243, -243, 0, 243, 486, 486,
243,
-243, -486, -243, 243, 729, 972, 729, 0, -729, -729, 0, 729, 1458, 1458,
729,
-729, -1458, -729, 729, 2187, 2916

a ( 10000 ) is

2316411085401761584204983680958202048204005165587545409169467828\
8894378216438553160348718637881330207011206294044645403592\
7229557596183311011596479255540816147539602831574046477617\
4839166720057863021108019777076981740729497997488335603014\
2776996075772442894228614806968485748007727088036502247112\
56735867951293810526116

Alois

Leroy Quet schrieb:
> I just posted this:
>
> %I A163495
> %S A163495 0,1,2,2,1,1,2,1,1,3,4,3,0,3,3,0,3,6,6,3
> %V A163495 0,1,2,2,1,-1,-2,-1,1,3,4,3,0,-3,-3,0,3,6,6,3
> %N A163495 a(0)=0, a(1)=1, a(2)=2. For n>=3, a(n) = a(n-1) - min(a(n-2),a(n-3)).
> %K A163495 more,sign
> %O A163495 0,3
>
> Is there a closed (non-recursive) form for this sequence? (Maybe the closed form is involving, say, sine and the floor function. Or maybe the closed form is much simpler, maybe involving mod, say.)
>
> (And hopefully I didn't make a mistake figuring out the terms I submitted.)
>
> Thanks,
> Leroy Quet
>
> [ ( [ ([( [ ( ([[o0Oo0Ooo0Oo(0)oO0ooO0oO0o]]) ) ] )]) ] ) ]
>

```