login
A072733
Simple triangle-stretching N X N -> N bijection: Inverse of A072732.
7
0, 1, 5, 6, 2, 14, 15, 3, 9, 27, 28, 10, 4, 20, 44, 45, 21, 7, 13, 35, 65, 66, 36, 16, 8, 26, 54, 90, 91, 55, 29, 11, 19, 43, 77, 119, 120, 78, 46, 22, 12, 34, 64, 104, 152, 153, 105, 67, 37, 17, 25, 53, 89, 135, 189, 190, 136, 92, 56, 30, 18, 42, 76, 118, 170, 230, 231
OFFSET
0,3
PROG
(Scheme) (define (A072733 n) (packA072733 (A025581 n) (A002262 n)))
(define (packA001477 x y) (/ (+ (expt (+ x y) 2) x (* 3 y)) 2))
(define (packA072733 x y) (cond ((<= x y) (let ((half-x (floor->exact (/ x 2)))) (packA001477 half-x (+ half-x (* 2 (- y (* 2 half-x) (modulo x 2))) (modulo x 2))))) (else (let ((half-y (floor->exact (/ y 2)))) (packA001477 (+ 1 half-y (* 2 (- (-1+ x) (* 2 half-y) (modulo y 2))) (modulo y 2)) half-y)))))
CROSSREFS
Inverse: A072732, projections: A072738 & A072739, variant of the same theme: A072735. Cf. also A001477 and its projections A025581 & A002262.
Sequence in context: A107825 A201332 A049253 * A018851 A260463 A226533
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, Jun 12 2002
STATUS
approved