login
For n >= 1, a(n) = f(n) where f is a bijection on Z such that f(x)-x is also a bijection on Z and f(f(x)) = x.
0

%I #36 Aug 09 2020 03:57:39

%S 2,1,6,9,12,3,16,19,4,23,26,5,30,33,36,7,40,43,8,47,50,53,10,57,60,11,

%T 64,67,70,13,74,77,14,81,84,15,88,91,94,17,98,101,18,105,108,111,20,

%U 115,118,21,122,125,22,129,132,135,24,139,142,25,146,149,152

%N For n >= 1, a(n) = f(n) where f is a bijection on Z such that f(x)-x is also a bijection on Z and f(f(x)) = x.

%C This appears in the problem of finding a bijection f on Z such that f(x)-x is also a bijection on Z. a(n) is the value on the natural numbers of an f satisfying the above condition as well as f(f(n)) = n. It is interesting to note that all a(n) such that a(n) > n are precisely A184119 (empirical) and ones satisfying a(n) <= n are precisely A136119 (empirical).

%F a(1) = 2 and for all i > 1 we define a(i) as follows:

%F Rule 1 : a(i) = j if there is some j such that j < i and a(j) = i.

%F Rule 2 : If Rule 1 cannot be performed then a(i) = i+2n+3 , if this rule applied n times previously.

%e We begin with a(1) = 2.

%e To calculate a(2): we first check if 2 has appeared in this sequence before. Indeed since a(1) = 2 we set a(2) = 1.

%e For a(3): observe that 3 has not appeared before so we can't apply Rule 1. Since we have performed rule 2 zero times before, therefore, a(3) = 3+2(0)+3 = 6.

%e For a(4): we cannot apply Rule 1 as 4 has not appeared before. We have applied Rule 2 one time before and hence a(4) = 4+2(1)+3 = 9.

%e Similarly a(5) = 5+2(2)+3 = 12.

%e However for a(6) we see a(3) = 6 and hence due to Rule 1, we must set a(6) = 3.

%p a:= proc() local h, t; t:=0; proc(n) option remember;

%p if n<3 then 3-n else h:= 3+n+2*t;

%p a(h):= n; t:= t+1; h fi end

%p end():

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Jun 17 2020

%t Nest[Append[#1, If[! FreeQ[#1[[All, 1]], #2], {FirstPosition[#1[[All, 1]], #2][[1]], #1[[-1, -1]]}, {#2 + 2 #1[[-1, -1]] + 3, 1 + #1[[-1, -1]]}]] & @@ {#, Length[#] + 1} &, {{2, 0}}, 62][[All, 1]] (* _Michael De Vlieger_, Jun 17 2020 *)

%o (Python)

%o Used = [(1, 2)]

%o def bfun(num):

%o print("a(1)=2")

%o for i in range(2, num + 1):

%o if any(i in coordinate for coordinate in Used):

%o for j in range(0, len(Used) + 1):

%o if i in Used[j]:

%o print("a(" + str(i) + ")=" + str(Used[j][0]))

%o break

%o else:

%o Used.append((i, i + 2 * len(Used) + 1))

%o print("a(" + str(i) + ")=" + str(i + 2 * len(Used) - 1))

%o bfun(70)

%Y Cf. A136119, A184119.

%K nonn

%O 1,1

%A _Bhavya Tiwari_, Jun 17 2020