cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A384616 A(m,n) is the maximum sum of absolute differences of the labels of adjacent vertices of the grid graph P_m X P_n where the m*n labels are exactly 1, 2, ..., m*n.

This page as a plain text file.
%I A384616 #43 Jun 30 2025 17:21:00
%S A384616 0,1,8,3,23,58,7,44,115
%N A384616 A(m,n) is the maximum sum of absolute differences of the labels of adjacent vertices of the grid graph P_m X P_n where the m*n labels are exactly 1, 2, ..., m*n.
%C A384616 A(m, n) ~ Theta((m*n)^2) (see link).
%H A384616 Sela Fried, <a href="/A384616/a384616.pdf">On the maximal sum of absolute differences of certain labelings of the grid graph</a>, 2025.
%F A384616 Conjecture: A(m,2) = A067725(m-1) - 1.
%e A384616 Array begins (values in parentheses are conjectural):
%e A384616   [1]  0
%e A384616   [2]  1    8
%e A384616   [3]  3   23    58
%e A384616   [4]  7   44   115   (216)
%e A384616   [5] 11   71  (182)  (347)  (554)
%e A384616   [6] 17  104  (271)  (508)  (815) (1192)
%e A384616   [7] 23  143  (370)  (699) (1118) (1639) (2250)
%e A384616   [8] 31 (188) (491)  (920) (1475) (2156) (2963) (3896)
%e A384616   [9] 39 (239) (622) (1171) (1874) (2743) (3766) (4955) (6298)
%o A384616 (Python)
%o A384616 import itertools
%o A384616 import numpy as np
%o A384616 def max_difference_sum(m, n):
%o A384616     nums = list(range(1, m * n + 1))
%o A384616     max_sum = 0
%o A384616     best_matrix = None
%o A384616     for perm in itertools.permutations(nums):
%o A384616         matrix = np.array(perm).reshape((m, n))
%o A384616         diff_sum = np.sum(np.abs(matrix[:,1:]-matrix[:,:-1])) + np.sum(np.abs(matrix[1:,:]-matrix[:-1,:]))
%o A384616         if diff_sum > max_sum:
%o A384616             max_sum = diff_sum
%o A384616             best_matrix = matrix.copy()
%o A384616     return max_sum, best_matrix
%o A384616 for m in range(1, 10):
%o A384616     for n in range(1, m+1):
%o A384616         max_sum, best = max_difference_sum(m, n)
%o A384616         print(max_sum, end=', ')
%Y A384616 Column 1 is A047838.
%Y A384616 Cf. A067725.
%K A384616 nonn,tabl,more
%O A384616 1,3
%A A384616 _Sela Fried_, Jun 07 2025