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.

A366525 Irregular triangular array read by rows: T(n,k) = number of partitions p of n such that f(p) = k >= 0, where f is defined in Comments.

This page as a plain text file.
%I A366525 #17 Nov 12 2023 12:58:34
%S A366525 1,1,1,2,1,2,3,4,3,3,6,2,6,6,3,5,9,5,3,7,9,9,4,1,7,13,12,6,4,10,12,15,
%T A366525 12,5,2,7,16,19,16,12,5,2,12,16,24,22,18,6,3,11,20,28,29,24,14,6,3,12,
%U A366525 19,31,34,36,24,13,4,3,12,23,36,42,50,30,25,8,4
%N A366525 Irregular triangular array read by rows: T(n,k) = number of partitions p of n such that f(p) = k >= 0, where f is defined in Comments.
%C A366525 For a partition p = (p(1),p(2),...,p(k)) of n, where p(1) >= p(2) >= ... >= p(k), define r(p) by subtracting 1 from p(1) and adding 1 to p(k) and then arranging the result in nonincreasing order. Iterating r eventually results in repetition; the function f(p) is the number of iterations of r up to but not including the first repeat. For example, starting with (5,3,2,2,1,1,1,1), the r-iterates are (4,3,2,2,2,1,1,1), (3,3,2,2,2,2,1,1), (3,2,2,2,2,2,2,1), (2,2,2,2,2,2,2,2), (3,2,2,2,2,2,2,1), so that f(5,3,2,2,1,1,1,1) = 3.
%H A366525 John Tyler Rascoe, <a href="/A366525/b366525.txt">Rows n = 1..60, flattened</a>
%e A366525 First 18 rows:
%e A366525    1
%e A366525    1     1
%e A366525    2     1
%e A366525    2     3
%e A366525    4     3
%e A366525    3     6     2
%e A366525    6     6     3
%e A366525    5     9     5     3
%e A366525    7     9     9     4     1
%e A366525    7    13    12     6     4
%e A366525   10    12    15    12     5     2
%e A366525    7    16    19    16    12     5    2
%e A366525   12    16    24    22    18     6    3
%e A366525   11    20    28    29    24    14    6      3
%e A366525   12    19    31    34    36    24    13     4     3
%e A366525   12    23    36    42    50    30    25     8     4    1
%e A366525   16    23    42    54    59    45    34    15     5    4
%e A366525   13    28    47    57    74    61    52    28    16    5    4
%e A366525 Row 6 represents 3 partitions p that are self-repeating (i.e., k = 0), 6 such that f(p) = 1, and 2 such that f(p) = 2. Specifically,
%e A366525   f(p) = 0 for these partitions: [6], [2,2,1,1], [2,1,1,1].
%e A366525 f(p) = 1 for these: [4,2], [3,3], [3,2,1], [3,1,1,1], [2,2,2], [1,1,1,1,1,1].
%e A366525 f(p) = 2 for these: [5,1], [4,1,1].
%t A366525 r[list_] := If[Length[list] == 1, list, Reverse[Sort[# +
%t A366525 Join[{-1}, ConstantArray[0, Length[#] - 2], {1}]] &[Reverse[Sort[list]]]]];
%t A366525 f[list_] := NestWhileList[r, Reverse[Sort[list]], Unequal, All];
%t A366525 t = Table[BinCounts[#, {0, Max[#] + 1, 1}] &[Map[-1 + Length[Union[#]] &[f[#]] &, IntegerPartitions[n]]], {n, 1,20}]
%t A366525 Map[Length, t]; t1 = Take[t, 18]; TableForm[t1]
%t A366525 Flatten[t1]
%t A366525 (* _Peter J. C. Moses_, Oct 10 2023 *)
%o A366525 (Python)
%o A366525 from sympy .utilities.iterables import ordered_partitions
%o A366525 from collections import Counter
%o A366525 def A366525_rowlist(row_n):
%o A366525     A = []
%o A366525     for i in range(1,row_n+1):
%o A366525         A.append([]); p,C = list(ordered_partitions(i)),Counter()
%o A366525         for j in range(0,len(p)):
%o A366525             x,a1,a,b = 0,[],list(p[j]),list(p[j])
%o A366525             while i:
%o A366525                 b[-1] -= 1; b[0] += 1
%o A366525                 if b[-1] == 0: b.pop(-1)
%o A366525                 b = sorted(b); x += 1
%o A366525                 if a == b or a1 == b:
%o A366525                     C.update({x}); break
%o A366525                 else:
%o A366525                     a1 = a.copy(); a = b.copy()
%o A366525         for z in range(1,len(C)+1): A[i-1].append(C[z])
%o A366525     return(A) # _John Tyler Rascoe_, Nov 09 2023
%Y A366525 Cf. A000041 (row sums), A003479 (row lengths, after 2nd term).
%Y A366525 Cf. A062968 (1st column).
%K A366525 nonn,tabf
%O A366525 1,4
%A A366525 _Clark Kimberling_, Oct 12 2023