login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Let b be an odd function such that b(0) = 0, b(1) = 1, and for any n > 1 such that 3^x < 2*n < 3^(x+1) for some x > 0, b(n) = b(3^x-n) - 3^x; a(n) = abs(b(n)) for any n >= 0.
1

%I #16 Aug 22 2021 13:18:38

%S 0,1,2,3,4,13,12,11,8,9,10,7,6,5,32,33,34,37,36,35,38,39,40,31,30,29,

%T 26,27,28,25,24,23,14,15,16,19,18,17,20,21,22,103,102,101,98,99,100,

%U 97,96,95,104,105,106,109,108,107,110,111,112,121,120,119,116

%N Let b be an odd function such that b(0) = 0, b(1) = 1, and for any n > 1 such that 3^x < 2*n < 3^(x+1) for some x > 0, b(n) = b(3^x-n) - 3^x; a(n) = abs(b(n)) for any n >= 0.

%C This sequence is a self-inverse permutation of the nonnegative integers.

%C It is possible to build a continuous injective complex-valued function of a real-variable, say f, such that Im(f(r)) = 0 iff r is an integer and for any n in Z, f(n) = b(n) (see illustration in Links section).

%H Rémy Sigrist, <a href="/A338478/b338478.txt">Table of n, a(n) for n = 0..6560</a>

%H Rémy Sigrist, <a href="/A338478/a338478.png">Representation in the complex plane of a function f as described in Comments section</a> (the corresponding curve divides the complex plane into two simply connected regions rendered with different colors)

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(n) = n iff abs(n - 3^x) <= 1 for some x >= 0.

%e For n = 3:

%e - we have 3^1 < 2*3 < 3^(1+1),

%e - so b(3) = b(3 - 3) - 3 = 0 - 3 = -3,

%e - a(3) = abs(b(3)) = 3.

%o (PARI) b(n) = { if (n<0, return (-b(-n)), n==0, return (0), n==1, return (1), for (x=1, oo, my (w=3^x, h=w\2); if (w<2*n && 2*n<3*w, return (b(w-n)-w)))) }

%o a(n) = abs(b(n))

%Y Cf. A000244, A003462, A024023, A034472, A105209.

%K nonn

%O 0,3

%A _Rémy Sigrist_, Oct 29 2020