A080542 In binary representation: keep the first digit and rotate right the others.
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, 29, 22, 30, 23, 31, 32, 48, 33, 49, 34, 50, 35, 51, 36, 52, 37, 53, 38, 54, 39, 55, 40, 56, 41, 57, 42, 58, 43, 59, 44, 60, 45, 61, 46, 62, 47, 63, 64, 96, 65, 97, 66, 98, 67, 99, 68
Offset: 1
Examples
a(20) = a('10100') = '10010' = 18. a(25) = a('11001') = '11100' = 28.
Links
Crossrefs
Programs
-
Mathematica
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 *)
-
Python
def A080542(n): return (1+(n&1))*(1<
>1) if n > 1 else n # Chai Wah Wu, Jan 22 2023 -
R
nmax <- 31 # by choice a <- 1:3 for(n in 1:nmax) for(k in 0:3) a[4*n + k] = 2*a[2*n + (k == 1 | k == 3)] + (k == 2 | k == 3) a # Yosu Yurramendi, Sep 05 2020
-
Scheme
(define (A080542 n) (if (< n 2) n (+ (A053644 n) (+ (* (A000035 n) (A072376 n)) (A004526 (A053645 n)))))) ;; Antti Karttunen, May 16 2015
Formula
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.
From Antti Karttunen, May 16 2015: (Start)
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.]
Other identities. For all n >= 1:
(End)
Comments