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.
%I A374996 #23 Aug 04 2024 08:16:14 %S A374996 0,1,0,2,1,0,2,2,1,0,3,2,2,1,0,3,3,2,2,1,0,3,4,3,2,2,1,0,3,3,4,3,2,2, %T A374996 1,0,4,3,3,4,3,2,2,1,0,4,4,3,3,4,3,2,2,1,0,4,4,4,3,3,4,3,2,2,1,0,4,3, %U A374996 5,4,3,3,4,3,2,2,1,0,4,5,3,5,4,3,3,4,3,2,2,1,0 %N A374996 Square array read by antidiagonals: T(n,k) is the total cost when the elements of the k-th composition (in standard order) are requested from a self-organizing list initialized to (1, 2, 3, ...), using the move-ahead(n) updating strategy; n, k >= 0. %C A374996 The cost of a request equals the position of the requested element in the list. %C A374996 After a request, the requested element is moved n steps closer to the front of the list (or to the front if the element is already less than n steps from the front). %H A374996 John Tyler Rascoe, <a href="/A374996/b374996.txt">Antidiagonals n = 0..139, flattened</a> %H A374996 Ran Bachrach and Ran El-Yaniv, <a href="https://dl.acm.org/doi/10.5555/314161.314180">Online list accessing algorithms and their applications: recent empirical evidence</a>, Proceedings of the 8th annual ACM-SIAM symposium on discrete algorithms, SODA ’97, New Orleans, LA, January 5-7, 1997, 53-62. %H A374996 Wikipedia, <a href="https://en.wikipedia.org/wiki/Self-organizing_list">Self-organizing list</a>. %F A374996 T(n,k) = A374992(k) if n >= A333766(k)-1. %F A374996 The sum of T(n,k) over all k such that A000120(k) = j (number of requests) and A333766(k) <= m (upper bound on the requested elements) equals m^j * j * (m+1)/2. This is a consequence of the fact that the first m positions of the list are occupied by the elements 1, ..., m, as long as no element larger than m has been requested so far. %F A374996 T(n,k) = T(n,A025480(k-1)) + A375001(n,k) for n >= 0 and k >= 1. %e A374996 Array begins: %e A374996 n\k| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 %e A374996 ---+----------------------------------------------- %e A374996 0 | 0 1 2 2 3 3 3 3 4 4 4 4 4 4 4 4 %e A374996 1 | 0 1 2 2 3 4 3 3 4 4 3 5 4 5 4 4 %e A374996 2 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 3 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 4 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 5 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 6 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 7 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 8 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 9 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 10 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 11 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 12 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 13 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 14 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %e A374996 15 | 0 1 2 2 3 4 3 3 4 5 3 5 4 5 4 4 %o A374996 (Python) %o A374996 def comp(n): %o A374996 # see A357625 %o A374996 return %o A374996 def A374996(n,k): %o A374996 if k<1: return 0 %o A374996 cost,c = 0,comp(k) %o A374996 m = list(range(1,max(c)+1)) %o A374996 for i in c: %o A374996 j = m.index(i) %o A374996 cost += j+1 %o A374996 jp = 0 %o A374996 if j >= n: %o A374996 jp += j-n %o A374996 m.insert(jp,m.pop(j)) %o A374996 return cost # _John Tyler Rascoe_, Aug 02 2024 %Y A374996 Cf. A000120, A025480, A029837 (row n=0), A374993 (row n=1), A333766, A374992, A375001. %K A374996 nonn,tabl %O A374996 0,4 %A A374996 _Pontus von Brömssen_, Jul 27 2024