OFFSET
1,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10585; the first 145 rows of triangle/antidiagonals of array
Eric Weisstein's World of Mathematics, Pairing Function
EXAMPLE
The top left 12 X 12 corner of the array:
1, 3, 3, 10, 3, 21, 3, 36, 10, 21, 3, 78
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
7, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0
11, 8, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0
16, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0
22, 12, 8, 0, 0, 27, 0, 0, 0, 0, 0, 0
29, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0
37, 17, 0, 19, 0, 0, 0, 44, 0, 0, 0, 0
46, 0, 12, 0, 0, 0, 0, 0, 14, 0, 0, 0
56, 23, 0, 0, 8, 0, 0, 0, 0, 27, 0, 0
67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0
The first fifteen rows of triangle:
1,
3, 2,
3, 0, 4,
10, 0, 5, 7,
3, 0, 0, 0, 11,
21, 0, 0, 5, 8, 16,
3, 0, 0, 0, 0, 0, 22,
36, 0, 0, 0, 14, 0, 12, 29,
10, 0, 0, 0, 0, 0, 8, 0, 37,
21, 0, 0, 0, 0, 5, 0, 0, 17, 46,
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56,
78, 0, 0, 0, 0, 0, 27, 0, 19, 12, 23, 67,
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,
21, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 30, 92,
21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 17, 0, 106
PROG
(Scheme)
(define (A286246bi row col) (if (not (zero? (modulo (+ row col -1) col))) 0 (let ((a (A046523 col)) (b (/ (+ row col -1) col))) (* (/ 1 2) (+ (expt (+ a b) 2) (- a) (- (* 3 b)) 2)))))
;; Alternatively, with triangular indexing:
(define (A286246tr n k) (A286246bi k (+ 1 (- n k))))
(Python)
from sympy import factorint
def T(n, m): return ((n + m)**2 - n - 3*m + 2)/2
def P(n):
f = factorint(n)
return sorted([f[i] for i in f])
def a046523(n):
x=1
while True:
if P(n) == P(x): return x
else: x+=1
def A(n, k): return 0 if (n + k - 1)%k!=0 else T(a046523(k), (n + k - 1)/k)
for n in range(1, 21): print [A(k, n - k + 1) for k in range(1, n + 1)] # Indranil Ghosh, May 09 2017
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, May 06 2017
STATUS
approved