login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A273672 Permutation of natural numbers induced by looking up the position of fraction A270418(n)/A270419(n) from the full Stern-Brocot tree A007305(n+1)/A047679(n-1). 5
1, 3, 7, 15, 31, 63, 127, 2, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 6, 33554431, 67108863, 4, 268435455, 536870911, 1073741823, 2147483647, 128, 8589934591, 17179869183, 34359738367, 68719476735, 137438953471, 274877906943, 549755813887, 14 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
PROG
(Scheme)
(define (A273672 n) (SBtree_index (A270418 n) (A270419 n)))
(define (SBtree_index m n) (let loop ((m m) (n n) (z 1)) (cond ((= m n) z) ((< m n) (loop m (- n m) (+ z z))) (else (loop (- m n) n (+ z z 1))))))
(PARI)
A065620(n, c=1) = sum(i=0, logint(n+!n, 2), if(bittest(n, i), (-1)^c++<<i)); \\ From A065620
SBtree_index(r) = { my(m=numerator(r), n=denominator(r), z=1); while(m!=n, if(m<n, n-=m; z<<=1, m-=n; z<<=1; z++)); (z); };
A273672(n) = { n=factor(n); n[, 2] = apply(A065620, n[, 2]); SBtree_index(factorback(n)); }; \\ Antti Karttunen, Mar 07 2020, based also on M. F. Hasler's code in A270418 and A270419
CROSSREFS
Inverse: A273671.
Cf. also A007305, A047679.
Sequence in context: A147596 A115567 A275715 * A043740 A336683 A283091
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 27 2016
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 08:27 EDT 2024. Contains 371698 sequences. (Running on oeis4.)