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.

A332783 The number of permutations of {(n+1) 1's, (n+1) 2's, ..., (n+1) n's} with the property that k's are equally spaced for k=1..n and the interval of k+1 is less than or equal to the interval of k for k=1..n-1.

This page as a plain text file.
%I A332783 #41 Sep 26 2023 14:01:43
%S A332783 1,4,16,104,484,4848,25104,300336,2335296,27953952,198725952,
%T A332783 4731323904,33020828928,606237831936,8936541384192,174694058933760,
%U A332783 1628654065588224,56338295740213248,545177455792662528,20766878061520306176,340162958990367645696
%N A332783 The number of permutations of {(n+1) 1's, (n+1) 2's, ..., (n+1) n's} with the property that k's are equally spaced for k=1..n and the interval of k+1 is less than or equal to the interval of k for k=1..n-1.
%e A332783 Define the interval of k as b(k).
%e A332783 In case of n = 1.
%e A332783      |        | b(1)
%e A332783 -----+--------+-----
%e A332783    1 | [1, 1] | [0]
%e A332783 In case of n = 2.
%e A332783      |                    | b(1),b(2)
%e A332783 -----+--------------------+----------
%e A332783    1 | [2, 2, 2, 1, 1, 1] | [0, 0]
%e A332783    2 | [2, 1, 2, 1, 2, 1] | [1, 1]
%e A332783    3 | [1, 2, 1, 2, 1, 2] | [1, 1]
%e A332783    4 | [1, 1, 1, 2, 2, 2] | [0, 0]
%e A332783 In case of n = 3.
%e A332783      |                                      | b(1),b(2),b(3)
%e A332783 -----+--------------------------------------+---------------
%e A332783    1 | [3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1] | [0, 0, 0]
%e A332783    2 | [3, 3, 3, 3, 2, 1, 2, 1, 2, 1, 2, 1] | [1, 1, 0]
%e A332783    3 | [3, 3, 3, 3, 1, 2, 1, 2, 1, 2, 1, 2] | [1, 1, 0]
%e A332783    4 | [3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2] | [0, 0, 0]
%e A332783    5 | [3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1] | [2, 2, 2]
%e A332783    6 | [3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2] | [2, 2, 2]
%e A332783    7 | [2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1] | [2, 2, 2]
%e A332783    8 | [1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2] | [2, 2, 2]
%e A332783    9 | [2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3] | [2, 2, 2]
%e A332783   10 | [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3] | [2, 2, 2]
%e A332783   11 | [2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1] | [0, 0, 0]
%e A332783   12 | [1, 1, 1, 1, 3, 3, 3, 3, 2, 2, 2, 2] | [0, 0, 0]
%e A332783   13 | [2, 2, 2, 2, 1, 1, 1, 1, 3, 3, 3, 3] | [0, 0, 0]
%e A332783   14 | [2, 1, 2, 1, 2, 1, 2, 1, 3, 3, 3, 3] | [1, 1, 0]
%e A332783   15 | [1, 2, 1, 2, 1, 2, 1, 2, 3, 3, 3, 3] | [1, 1, 0]
%e A332783   16 | [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] | [0, 0, 0]
%o A332783 (Ruby)
%o A332783 def search(a, num, d, k, n)
%o A332783   if num == 0
%o A332783     @cnt += 1
%o A332783   else
%o A332783     (k * n - k + 1).times{|i|
%o A332783       if a[i] == 0
%o A332783         (i + d + 1..k * n - k + 1).each{|j|
%o A332783           if (k - 1) * j - (k - 2) * i < k * n
%o A332783             if (1..k - 1).all?{|m| a[m * j - (m - 1) * i] == 0}
%o A332783               (0..k - 1).each{|m| a[m * j - (m - 1) * i] = num}
%o A332783               search(a, num - 1, j - i - 1, k, n)
%o A332783               (0..k - 1).each{|m| a[m * j - (m - 1) * i] = 0}
%o A332783             end
%o A332783           end
%o A332783         }
%o A332783       end
%o A332783     }
%o A332783   end
%o A332783 end
%o A332783 def A(k, n)
%o A332783   a = [0] * k * n
%o A332783   @cnt = 0
%o A332783   search(a, n, 0, k, n)
%o A332783   @cnt
%o A332783 end
%o A332783 def A332783(n)
%o A332783   (1..n).map{|i| A(i + 1, i)}
%o A332783 end
%o A332783 p A332783(5)
%Y A332783 Cf. A104442, A332762, A332784, A322178, A332748, A332752, A332773.
%K A332783 nonn
%O A332783 1,2
%A A332783 _Seiichi Manyama_, Feb 23 2020
%E A332783 a(9)-a(17) from _Bert Dobbelaere_, Mar 08 2020
%E A332783 a(18)-a(21) from _Max Alekseyev_, Sep 26 2023