cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A284120 Permutation of the positive integers: a(n) = A258746(A117120(n)) = A117120(A258746(n)).

This page as a plain text file.
%I A284120 #14 Jun 02 2025 12:20:55
%S A284120 1,2,3,4,5,6,7,9,8,11,10,13,12,15,14,18,19,16,17,22,23,20,21,26,27,24,
%T A284120 25,30,31,28,29,37,36,39,38,33,32,35,34,45,44,47,46,41,40,43,42
%N A284120 Permutation of the positive integers: a(n) = A258746(A117120(n)) = A117120(A258746(n)).
%C A284120 The permutation is self-inverse. Except for fixed points 1, 2, 3, 4, 5, 6, 7 it consists completely of 2-cycles: (10,11), (12,13), (14,15), (16,18), (17,19), (20,22), (21,23), (24,26), (25,27), (28,30), (29,31), (32,37), (33,36), (34,39), (35,38), (45,40), ...
%C A284120 {A000027, A258746, A117120, a = A258746(A117120)} form a Klein 4-group.
%H A284120 Yosu Yurramendi, <a href="/A284120/b284120.txt">Table of n, a(n) for n = 1..32767</a>
%t A284120 A[n_]:= If[n<4, n, If[EvenQ[n], 2A[n/2] + 1, 2A[(n - 1)/2]]]; a[n_]:= If[n<4,n,If[OddQ[Floor[Log2[n]]], If[EvenQ[n], 2a[n/2], 2a[(n - 1)/2] + 1], If[EvenQ[n], 2a[n/2] + 1, 2a[(n - 1)/2]]]]; Table[a[A[n]],{n,50}] (* _Indranil Ghosh_, Mar 21 2017 *)
%o A284120 (R)
%o A284120 maxrow <- 6 # by choice
%o A284120 a <- 1:7
%o A284120 for(m in 2:maxrow) for(k in 0:(2^m-1)) {
%o A284120   if(m%%2 == 0) {a[2^(m+1)+2*k  ] <- 2*a[2^m+k]+1
%o A284120                  a[2^(m+1)+2*k+1] <- 2*a[2^m+k]  }
%o A284120   else          {a[2^(m+1)+2*k  ] <- 2*a[2^m+k]
%o A284120                  a[2^(m+1)+2*k+1] <- 2*a[2^m+k]+1}
%o A284120 }
%o A284120 a
%o A284120 (PARI)
%o A284120 A(n) = if(n<4, n, if(n%2, 2*A(n\2), 2*A(n/2)+1));
%o A284120 a(n) = if(n<4, n, if(logint(n, 2)%2, if(n%2, 2*a(n\2) + 1, 2*a(n/2)), if(n%2, 2*a(n\2), 2*a(n/2) + 1)));
%o A284120 for(n=1, 50, print1(a(A(n)),", ")) \\ _Indranil Ghosh_, Mar 21 2017, modified by _Charles R Greathouse IV_
%K A284120 nonn
%O A284120 1,2
%A A284120 _Yosu Yurramendi_, Mar 20 2017