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.

A080542 In binary representation: keep the first digit and rotate right the others.

This page as a plain text file.
%I A080542 #33 Jan 22 2023 16:28:36
%S A080542 1,2,3,4,6,5,7,8,12,9,13,10,14,11,15,16,24,17,25,18,26,19,27,20,28,21,
%T A080542 29,22,30,23,31,32,48,33,49,34,50,35,51,36,52,37,53,38,54,39,55,40,56,
%U A080542 41,57,42,58,43,59,44,60,45,61,46,62,47,63,64,96,65,97,66,98,67,99,68
%N A080542 In binary representation: keep the first digit and rotate right the others.
%C A080542 Permutation of natural numbers with inverse = A080541: A080541(a(n)) = a(A080541(n)) = n;
%C A080542 let r(n,0)=n, r(n,k)=a(r(n,k-1)) for k>0, then r(n,floor(log_2(n))) = n and for n>1: r(n,floor(log_2(n))-1) = A080541(n).
%C A080542 Discarding their most significant bit, binary representations of numbers present in each cycle of this permutation form a distinct equivalence class of binary necklaces, thus there are A000031(n) separate cycles in each range [2^n .. (2^(n+1))-1] (for n >= 0) of this permutation.  A256999 gives the largest number present in n's cycle. - _Antti Karttunen_, May 16 2015
%H A080542 Antti Karttunen, <a href="/A080542/b080542.txt">Table of n, a(n) for n = 1..8192</a>
%H A080542 <a href="/index/Ne#necklaces">Index entries for sequences related to necklaces</a>
%H A080542 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A080542 a(n) = 2^log2(n) + floor((n-2^log2(n))/2) + (n mod 2)*2^(log2(n)-1), where log2(n) is the integer part of base-2 logarithm.
%F A080542 From _Antti Karttunen_, May 16 2015: (Start)
%F A080542 a(1) = 1; for n > 1, a(n) = A053644(n) + (A000035(n)*A072376(n)) + A004526(A053645(n)). [Essentially the same formula but represented with A-numbers.]
%F A080542 Other identities. For all n >= 1:
%F A080542 a(n) = A059893(A080541(A059893(n))).
%F A080542 a(n) = A054429(a(A054429(n))).
%F A080542 (End)
%e A080542 a(20) = a('10100') = '10010' = 18.
%e A080542 a(25) = a('11001') = '11100' = 28.
%t A080542 kfd[n_]:=Module[{a,b},{a,b}=TakeDrop[IntegerDigits[n,2],1];FromDigits[ Join[a,RotateRight[b]],2]]; Array[kfd,80] (* The program uses the TakeDrop function from Mathematica version 10 *) (* _Harvey P. Dale_, Feb 12 2016 *)
%o A080542 (Scheme) (define (A080542 n) (if (< n 2) n (+ (A053644 n) (+ (* (A000035 n) (A072376 n)) (A004526 (A053645 n))))))  ;; _Antti Karttunen_, May 16 2015
%o A080542 (R)
%o A080542 nmax <- 31 # by choice
%o A080542 a <- 1:3
%o A080542 for(n in 1:nmax) for(k in 0:3)
%o A080542 a[4*n + k] = 2*a[2*n + (k == 1 | k == 3)] + (k == 2 | k == 3)
%o A080542 a
%o A080542 # _Yosu Yurramendi_, Sep 05 2020
%o A080542 (Python)
%o A080542 def A080542(n): return (1+(n&1))*(1<<n.bit_length()-2)+(n>>1) if n > 1 else n # _Chai Wah Wu_, Jan 22 2023
%Y A080542 Inverse: A080541.
%Y A080542 Cf. A000031, A000035, A000523, A004526, A007088, A053644, A053645, A054429, A072376, A080414, A080544, A256999, A257250.
%Y A080542 The set of permutations {A059893, A080541, A080542} generates an infinite dihedral group.
%K A080542 nonn,base
%O A080542 1,2
%A A080542 _Reinhard Zumkeller_, Feb 20 2003