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.

A284447 Permutation of the positive integers: a(n) = A258996(A092569(n)) = A092569(A258996(n)).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 8, 9, 10, 11, 20, 21, 22, 23, 16, 17, 18, 19, 28, 29, 30, 31, 24, 25, 26, 27, 52, 53, 54, 55, 48, 49, 50, 51, 60, 61, 62, 63, 56, 57, 58, 59, 36, 37, 38, 39, 32, 33, 34, 35, 44, 45, 46, 47, 40, 41, 42, 43
Offset: 1

Views

Author

Yosu Yurramendi, Apr 06 2017

Keywords

Comments

The permutation is self-inverse. Except for fixed points 1, 2, 3, 4, 5, 6, 7 it consists completely of 2-cycles: (8,12), (9,13), (10,14), (11,15), (16,20), (17,21), (18,22), (19,23), (24,28), (25,29), (26,30), (27,31), (32,52), (33,53), (34,54), (35,55), (36,48), (37,49), (38,50), (39,51), (40,60), ...
{A000027, A258996, A092569, a = A258996(A092569)} form a Klein 4-group.

Crossrefs

Analogous to A284120. Similar R-programs: A258996, A332769.

Programs

  • R
    maxrow <- 8 # by choice
    a <- 1:3
    for(m in 1:maxrow) for(k in 0:(2^m-1)){
    if(m%%2 == 1){a[2^(m+1)+    k] <- a[2^m+k] + 2^m
                  a[2^(m+1)+2^m+k] <- a[2^m+k] + 2^(m+1)}
    else         {a[2^(m+1)+    k] <- a[2^m+k] + 2^(m+1)
                  a[2^(m+1)+2^m+k] <- a[2^m+k] + 2^m}
    }
    a
    # Yosu Yurramendi, Apr 06 2017
    
  • R
    # Given n, compute a(n) by taking into account the binary representation of n
    maxblock <- 7 # by choice
    a <- 1:7
    for(n in 8:2^maxblock){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      anbit <- nbit
      anbit[seq(3, length(anbit) - 1, 2)] <- 1 - anbit[seq(3, length(anbit) - 1, 2)]
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    a
    # Yosu Yurramendi, Mar 30 2021