login
A072734
Simple triangle-stretching N X N -> N bijection, variant of A072732.
8
0, 1, 2, 3, 12, 4, 7, 17, 18, 5, 6, 23, 40, 24, 8, 11, 31, 49, 50, 25, 9, 10, 30, 59, 84, 60, 32, 13, 16, 39, 71, 97, 98, 61, 33, 14, 15, 38, 70, 111, 144, 112, 72, 41, 19, 22, 48, 83, 127, 161, 162, 113, 73, 42, 20, 21, 47, 82, 126, 179, 220, 180, 128, 85, 51, 26, 29, 58
OFFSET
0,3
PROG
(Scheme) (define (A072734 n) (packA072734 (A025581 n) (A002262 n)))
(define (packA001477 x y) (/ (+ (expt (+ x y) 2) x (* 3 y)) 2))
(define (packA072734 x y) (let ((x-y (- x y))) (cond ((negative? x-y) (packA001477 (+ (* 2 x) (modulo (1+ x-y) 2)) (+ (* 2 x) (floor->exact (/ (+ (- x-y) (modulo x-y 2)) 2))))) ((< x-y 3) (packA001477 (+ (* 2 y) x-y) (* 2 y))) (else (packA001477 (+ (* 2 y) (floor->exact (/ (1+ x-y) 2)) (modulo (1+ x-y) 2)) (+ (* 2 y) (modulo x-y 2)))))))
CROSSREFS
Inverse: A072735, projections: A072740 & A072741, variant of the same theme: A072732. Used to construct the global arithmetic ranking scheme of plane binary trees presented in A072787/A072788. Cf. also A001477 and its projections A025581 & A002262.
Sequence in context: A288201 A288330 A162846 * A223524 A046207 A030611
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, Jun 12 2002
STATUS
approved