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.

A342937 Run lengths of A324608.

This page as a plain text file.
%I A342937 #18 Aug 12 2022 19:04:54
%S A342937 2,1,8,1,3,2,3,3,3,4,3,5,3,6,3,7,2,1,10,1,11,1,9,1,2,1,9,2,2,1,8,1,5,
%T A342937 1,8,1,3,1,2,1,8,1,3,1,3,1,8,1,3,1,2,2,1,8,1,3,1,3,2,1,8,1,3,2,5,1,8,
%U A342937 1,3,2,3,1,2,1,8,1,3,2,3,2,2,1,8,1,3,2
%N A342937 Run lengths of A324608.
%H A342937 Peter Kagey, <a href="https://math.stackexchange.com/q/4081203/121988">Run lengths of bits and run lengths of an auxiliary sequence</a>, Mathematics Stack Exchange.
%e A342937 A324608 begins 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 10, 11, 11, 11, 13, ..., with a(1) = 2 ones, a(2) = 1 two, a(3) = 8 threes, a(4) = 1 ten, a(5) = 3 elevens, and so on.
%e A342937 This sequence first disagrees with A341406 at n = 51, where a(51) = 2 and
%e A342937 A341406(51) = 1.
%t A342937 a[1]=1;a[2]=2;a[n_]:=a[n]=FromDigits[Flatten[IntegerDigits[#,2]&/@Table[a[k],{k,n-1}]][[;;n]],2]-Total@Table[a[m],{m,n-1}]
%t A342937 Length/@Split@Table[Count[IntegerDigits[a[l],2],1],{l,300}] (* _Giorgos Kalogeropoulos_, Mar 30 2021 *)
%o A342937 (Python)
%o A342937 from itertools import groupby
%o A342937 def aupton(terms):
%o A342937   A324608, bstr, rl_lst, rl_idx, n = [1, 1], "110", [], 0, 3
%o A342937   while len(rl_lst) < terms:
%o A342937     an = int(bstr[:n], 2) - int(bstr[:n-1], 2)
%o A342937     binan = bin(an)[2:]
%o A342937     A324608, bstr, n = A324608 + [binan.count('1')], bstr + binan, n+1
%o A342937     new_runs = [len(list(g)) for k, g in groupby(A324608[rl_idx:])]
%o A342937     if len(new_runs) > 0:
%o A342937       rl_lst.extend(new_runs[:-1]) # don't take last one in case mid-run
%o A342937       rl_idx += sum(new_runs[:-1])
%o A342937   return rl_lst[:terms]
%o A342937 print(aupton(86)) # _Michael S. Branicky_, Mar 30 2021
%Y A342937 Cf. A308092, A324608, A341406.
%K A342937 nonn,base
%O A342937 1,1
%A A342937 _Peter Kagey_, Mar 29 2021