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.

A380317 The lexicographically earliest sequence of positive numbers which is identical to the run lengths of its first differences.

This page as a plain text file.
%I A380317 #23 Feb 18 2025 18:39:08
%S A380317 1,1,2,2,2,3,4,3,2,2,2,2,3,4,5,6,5,4,3,3,3,2,1,1,1,2,3,3,3,3,4,5,6,7,
%T A380317 6,5,4,3,2,2,2,2,2,2,2,3,4,5,6,7,6,5,4,3,3,3,3,4,5,6,5,4,3,3,3,1,1,2,
%U A380317 2,2,3,4,5,4,3,2,2,2,2,3,4,5,4,3,2,1,1
%N A380317 The lexicographically earliest sequence of positive numbers which is identical to the run lengths of its first differences.
%C A380317 34 is the smallest value that does not appear in the first 10000 terms.
%C A380317 Conjecture: Every positive integer eventually appears.
%C A380317 Shortly after submitting this sequence the author, _Dominic McCarty_, discovered that it is almost identical to A281579: in fact, a(n) = A281579(n) - 1 for all n. However, since A281579 has seniority and the present sequence has a simpler definition and is more likely to be searched for, it has been decided to retain both entries. - _N. J. A. Sloane_, Feb 17 2025
%C A380317 The index of n in the present sequence is given by A281900(n+1).
%H A380317 Dominic McCarty, <a href="/A380317/b380317.txt">Table of n, a(n) for n = 1..10000</a>
%e A380317 The sequence of first differences (where the n-th term is a(n+1)-a(n)) is:
%e A380317 0, 1, 0, 0, 1, 1, -1, -1, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, 0, 0, ...
%e A380317 The run lengths of consecutive values are:
%e A380317 1, 1, 2, 2, 2, 3, 4, 3, 2, ...
%e A380317 Which is the original sequence.
%o A380317 (Python)
%o A380317 from itertools import groupby
%o A380317 def runs(l): return [len(list(group)) for i, group in groupby(l)]
%o A380317 def firstDifs(l): return [l[i]-l[i-1] for i in range(1,len(l))]
%o A380317 a = [1,1]
%o A380317 while len(runs(firstDifs(a))) <= 100:
%o A380317     a.append(1)
%o A380317     b, m = runs(firstDifs(a)), max(firstDifs(a))
%o A380317     while not (all(b[n] == a[n] for n in range(len(b)-1)) and b[-1] <= a[len(b)-1]):
%o A380317         a[-1] += 1
%o A380317         if a[-1] > m+a[-2]+1: a.pop(); a[-1] += 1 #Backtracking needed
%o A380317         b = runs(firstDifs(a))
%o A380317 print(a[:len(runs(firstDifs(a)))])
%Y A380317 Cf. A281579, A281900.
%K A380317 nonn,nice,look
%O A380317 1,3
%A A380317 _Dominic McCarty_, Feb 13 2025