login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A284120
Permutation of the positive integers: a(n) = A258746(A117120(n)) = A117120(A258746(n))
2
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, 25, 30, 31, 28, 29, 37, 36, 39, 38, 33, 32, 35, 34, 45, 44, 47, 46, 41, 40, 43, 42
OFFSET
1,2
COMMENTS
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), ...
{A000027, A258746, A117120, a = A258746(A117120)} form a Klein 4-group.
LINKS
MATHEMATICA
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 *)
PROG
(R)
maxrow <- 6 # by choice
a <- 1:7
for(m in 2:maxrow) for(k in 0:(2^m-1)) {
if(m%%2 == 0) {a[2^(m+1)+2*k ] <- 2*a[2^m+k]+1
a[2^(m+1)+2*k+1] <- 2*a[2^m+k] }
else {a[2^(m+1)+2*k ] <- 2*a[2^m+k]
a[2^(m+1)+2*k+1] <- 2*a[2^m+k]+1}
}
a
(PARI)
A(n) = if(n<4, n, if(n%2, 2*A(n\2), 2*A(n/2)+1));
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)));
for(n=1, 50, print1(a(A(n)), ", ")) \\ Indranil Ghosh, Mar 21 2017, modified by Charles R Greathouse IV
CROSSREFS
Sequence in context: A294660 A180198 A180199 * A183081 A140595 A187098
KEYWORD
nonn
AUTHOR
Yosu Yurramendi, Mar 20 2017
STATUS
approved