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.

A221646 A continuous "Look and Say" sequence (without repetition, method 2).

This page as a plain text file.
%I A221646 #44 Apr 18 2021 02:16:10
%S A221646 1,1,1,2,1,1,2,2,1,2,2,1,1,2,2,2,1,3,2,1,1,1,3,1,2,3,1,1,3,1,1,1,2,1,
%T A221646 3,2,1,1,3,3,1,1,2,1,1,1,3,1,2,2,1,2,3,2,1,1,2,3,1,1,3,1,1,2,2,1,1,1,
%U A221646 2,1,3,1,2,2,1,1,2,1,3,2,1,1,3,2,1,2,2
%N A221646 A continuous "Look and Say" sequence (without repetition, method 2).
%C A221646 A variant of Conway's 'Look-and-Say' sequence A005150, without run cut-off. It describes at each step the preceding digits taken altogether.
%C A221646 There are different optional rules to build such a sequence. This method 2 does not consider already said digits.
%C A221646 As in the original Look-and-Say sequence, a(n) is always equal to 1, 2 or 3. The subsequence 3,3,3 never appears.
%C A221646 The sequence is determined by pairs of digits. Terms of even rank are counts while terms of odd rank are figures.
%H A221646 J.-C. Hervé, <a href="/A221646/b221646.txt">Table of n, a(n) for n = 1..10000</a>
%e A221646 a(1) = 1, then a(2) = 1 and a(3) = 1 (one 1). Leaving out the first 1 already said, we now have two 1's, then a(4) = 2 and a(5) = 1, and then a(6) = 1, a(7) = 2, a(8) = 2, a(9) = 1, etc.
%t A221646 n = 100; a[0] = 1; see = say = 0; While[say < n - 1, c = 0; dg = a[see]; While[see <= say, If[a[see] == dg, c += 1, Break[]]; see += 1]; a[++say] = c; If[say < n - 1, a[++say] = dg]]; Array[a, n, 0] (* _Jean-François Alcover_, Jul 11 2013, translated and adapted from J.-C. Hervé's C program *)
%o A221646 (C) /* computes first n terms in array a[] */
%o A221646 int *swys(int n) {
%o A221646 int a[n] ;
%o A221646 int see, say, c ;
%o A221646 a[0] = 1;
%o A221646 see = say = 0 ;
%o A221646 while( say < n-1 ) {
%o A221646   c = 0 ;     /* count */
%o A221646   dg = a[see] /* digit */
%o A221646   while (see <= say) {
%o A221646       if (a[see]== dg)  c += 1 ;
%o A221646       else break ;
%o A221646       see += 1 ;
%o A221646       }
%o A221646   a[++say] = c ;
%o A221646   if (say < n-1) a[++say] = dg ;
%o A221646   }
%o A221646 return(a);
%o A221646 }
%Y A221646 Cf. A005150 (original look-and-say sequence).
%Y A221646 Cf. A225212, A225224 (other continuous variants).
%K A221646 nonn,easy
%O A221646 1,4
%A A221646 _Jean-Christophe Hervé_, May 05 2013