login
A fractal function, related to ruler functions. a(1) = 0; otherwise for m >= 0, a(3m) = 1, a(3m-1) = a(2m-1) + sign(a(2m-1)), a(3m+1) = a(2m+1) + sign(a(2m+1)).
3

%I #12 Nov 02 2022 16:54:33

%S 1,0,0,1,2,2,1,3,3,1,4,4,1,2,2,1,5,5,1,3,3,1,2,2,1,6,6,1,4,4,1,2,2,1,

%T 3,3,1,7,7,1,2,2,1,5,5,1,3,3,1,2,2,1,4,4,1,8,8,1,2,2,1,3,3,1,6,6,1,2,

%U 2,1,4,4,1,3,3,1,2,2,1,5,5,1

%N A fractal function, related to ruler functions. a(1) = 0; otherwise for m >= 0, a(3m) = 1, a(3m-1) = a(2m-1) + sign(a(2m-1)), a(3m+1) = a(2m+1) + sign(a(2m+1)).

%C We choose a form for the definition that shows clearly its relationship to A307744.

%C The odd bisection is essentially A087088.

%C If we add a(-1) = 0 to the definition and allow negative m (and therefore n), we get a symmetric function, that is a(n) = a(-n).

%C For k >= 1 numbers 1..k occur with the same periodic and mirror symmetries as in A307744 and in ruler function A051064. In A051064, k occurs 3 times more frequently than k+1. Here, and in A307744, k occurs 3/2 times more frequently than k+1, precisely 2^(k-1) times in every 3^k terms.

%o (PARI) a(n) = if (n==1, 0, if ((n%3) == 0, 1, if ((n%3)==1, my(k=(n-1)/3, aa = a(2*k+1)); aa+sign(aa), my(k=(n+1)/3, aa = a(2*k-1)); aa+sign(aa)))); \\ _Michel Marcus_, Jul 03 2020

%Y Sequences with similar definitions: A205593, A307744.

%Y A051064 has matching symmetries.

%Y Odd bisection: A087088.

%K nonn,easy

%O 0,5

%A _Peter Munn_, Jun 30 2020