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.

A185173 Minimum number of distinct sums from consecutive terms in a circular permutation.

This page as a plain text file.
%I A185173 #51 Jul 09 2023 08:33:45
%S A185173 1,3,6,9,13,17,22,28,35,41,49,57,65,73,82,93,103,113,125,137
%N A185173 Minimum number of distinct sums from consecutive terms in a circular permutation.
%C A185173 a(n) <= n(n+1)/2, but this apparently is impossible for n >= 4. - _N. J. A. Sloane_, Mar 14 2012
%e A185173 a(4)=9 because the circular permutation 1243 has no way to get 5 as a sum of consecutive terms.
%e A185173 a(5)=13 because the circular permutation 12534 has no way to get 6 or 9 as a sum of consecutive terms.
%e A185173 From _Bert Dobbelaere_, Jun 24 2019: (Start)
%e A185173 Permutations achieving the minimum number of distinct sums:
%e A185173 a(1) = 1: {1}
%e A185173 a(2) = 3: {1, 2}
%e A185173 a(3) = 6: {1, 2, 3}
%e A185173 a(4) = 9: {1, 2, 4, 3}
%e A185173 a(5) = 13: {1, 2, 5, 3, 4}
%e A185173 a(6) = 17: {1, 3, 2, 4, 6, 5}
%e A185173 a(7) = 22: {1, 3, 2, 5, 7, 4, 6}
%e A185173 a(8) = 28: {1, 4, 3, 7, 6, 2, 8, 5}
%e A185173 a(9) = 35: {1, 3, 2, 4, 5, 8, 9, 6, 7}
%e A185173 a(10) = 41: {1, 3, 10, 9, 4, 6, 7, 2, 8, 5}
%e A185173 a(11) = 49: {1, 3, 5, 2, 8, 7, 4, 11, 10, 9, 6}
%e A185173 a(12) = 57: {1, 2, 6, 11, 10, 7, 4, 8, 9, 12, 5, 3}
%e A185173 a(13) = 65: {1, 2, 10, 12, 11, 13, 7, 5, 8, 3, 9, 4, 6}
%e A185173 a(14) = 73: {1, 4, 7, 2, 9, 14, 13, 11, 12, 10, 3, 6, 5, 8}
%e A185173 a(15) = 82: {1, 4, 5, 2, 3, 8, 14, 11, 12, 10, 15, 7, 6, 9, 13}
%e A185173 a(16) = 93: {1, 3, 8, 5, 10, 13, 4, 11, 16, 12, 14, 7, 6, 15, 2, 9} (End)
%e A185173 From _Bert Dobbelaere_, Jul 08 2023: (Start)
%e A185173 a(17) = 103: {1, 10, 5, 11, 4, 12, 6, 9, 7, 8, 3, 13, 2, 16, 14, 17, 15}
%e A185173 a(18) = 113: {1, 3, 10, 15, 2, 12, 13, 5, 7, 18, 17, 8, 6, 11, 14, 16, 9, 4}
%e A185173 a(19) = 125: {1, 5, 10, 3, 13, 2, 16, 14, 4, 8, 7, 11, 19, 15, 18, 12, 6, 9, 17}
%e A185173 a(20) = 137: {1, 3, 15, 2, 10, 7, 14, 19, 18, 13, 8, 9, 4, 6, 11, 20, 17, 16, 5, 12} (End)
%e A185173 From _Chai Wah Wu_, Oct 01-09 2021: (Start)
%e A185173 The following permutation also achieves a(13) = 65: {1, 2, 9, 10, 5, 13, 8, 7, 11, 4, 3, 12, 6}.
%e A185173 Number of permutations (modulo cyclic shifts and reflections) that achieve a(n) for n = 1..15 are 1,1,1,1,2,1,1,2,11,1,13,7,24,1,4. (End)
%o A185173 (Sage)
%o A185173 # a(n)=distinct_sum_count(n)
%o A185173 def distinct_sum_count(n):
%o A185173     min_sum_count=n*(n+1)/2
%o A185173     for p in Permutations(n=n):
%o A185173         if p[0]==1 and p[1]<p[-1]:  # remove cyclic shifts/reflections
%o A185173             sums=[]
%o A185173             for m in range(1,n+1):
%o A185173                 for i in range(n):
%o A185173                     q=0
%o A185173                     for j in range(m):
%o A185173                         q+=p[(i+j)%n]
%o A185173                     if not q in sums:
%o A185173                         sums.append(q)
%o A185173             if len(sums)<min_sum_count:
%o A185173                 min_sum_count=len(sums)
%o A185173     return min_sum_count
%o A185173 (Python)
%o A185173 from itertools import permutations
%o A185173 def A185173(n):
%o A185173     c = n*(n+1)//2
%o A185173     for i in range(2,n+1):
%o A185173         for j in range(i+1,n+1):
%o A185173             pset = set(range(2,n+1)) - {i,j}
%o A185173             for p in permutations(pset):
%o A185173                 q, rset, rl = [j,1,i]+list(p), set(), 0
%o A185173                 for k in range(n):
%o A185173                     r = 0
%o A185173                     for l in range(n):
%o A185173                         r += q[(k+l) % n]
%o A185173                         if r not in rset:
%o A185173                             rset.add(r)
%o A185173                             rl += 1
%o A185173                         if rl >= c:
%o A185173                             break
%o A185173                     else:
%o A185173                         continue
%o A185173                     break
%o A185173                 else:
%o A185173                     c = rl
%o A185173     return c # _Chai Wah Wu_, Oct 01 2021
%K A185173 nonn,nice,more
%O A185173 1,2
%A A185173 _Steve Butler_, Mar 12 2012
%E A185173 a(12)-a(16) from _Bert Dobbelaere_, Jun 24 2019
%E A185173 a(17)-a(20) from _Bert Dobbelaere_, Jul 08 2023