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.

A074299 Lengths of subsequences such that the first 'average' value (a[n]*1.5) is not achieved from the starting position in the Kolakoski sequence (A000002).

This page as a plain text file.
%I A074299 #18 Sep 28 2012 06:54:21
%S A074299 12,32,34,52,66,84,90,92,94,96,100,102,108,110,112,114,120,134,154,
%T A074299 156,166,172,174,194,196,202,216,230,248,254,256,258,260,266,268,272,
%U A074299 274,276,278,280,284,286,292,294,296,298,304,318,336,342,344,348,350,352
%N A074299 Lengths of subsequences such that the first 'average' value (a[n]*1.5) is not achieved from the starting position in the Kolakoski sequence (A000002).
%C A074299 All members of this sequence are even. 2n is in this sequence if and only if A074298(n)>1.
%C A074299 The even numbers missing from A022292.
%H A074299 Nathaniel Johnston, <a href="/A074299/b074299.txt">Table of n, a(n) for n = 1..10000</a>
%e A074299 The initial run of 12 adds up to 19, however if we start at position 3, then the sum is 18.
%t A074299 max = 200; kol = {1, 2, 2}; For[n=3, n <= 2*max, n++, For[i=1, i <= kol[[n]], i++, AppendTo[kol, 1 + Mod[n-1, 2]]]]; A074298[n_] := For[k=1, True, k++, If[Plus @@ kol[[k ;; k + 2*n - 1]] == 3*n, Return[k]]]; Select[2*Range[max], A074298[#/2] > 1 &] (* _Jean-François Alcover_, Sep 25 2012 *)
%o A074299 (JavaScript)
%o A074299 a=new Array();
%o A074299 a[1]=1; a[2]=2; a[3]=2; cd=1; ap=3;
%o A074299 for (i=4; i<1000; i++)
%o A074299 {
%o A074299     if (a[ap]==1) a[i]=cd;
%o A074299     else {a[i]=cd; a[i+1]=cd; i++}
%o A074299     ap++;
%o A074299     cd=3-cd;
%o A074299 }
%o A074299 b=new Array();
%o A074299 oc=0; tc=0; c=1;
%o A074299 for (i=1; i<1000; i++)
%o A074299 {
%o A074299     if (oc==tc) b[c++]=i-1;
%o A074299     if (a[i]==1) oc++;
%o A074299     else tc++;
%o A074299 }
%o A074299 /* document.write(b); */
%o A074299 /* document.write("<br>"); */
%o A074299 function isElement(x, arr)
%o A074299 {
%o A074299     for (j=1; j<arr.length; j++)
%o A074299     {
%o A074299         if (arr[j]==x) return true;
%o A074299         if (arr[j]>x) return false;
%o A074299     }
%o A074299     return false;
%o A074299 }
%o A074299 for (i=1; i<500; i++)
%o A074299     if (!isElement(2*i, b))
%o A074299         document.write(2*i+", ");
%o A074299 // _Jon Perry_, Sep 11 2012
%Y A074299 Cf. A074298, A022292
%K A074299 nonn
%O A074299 1,1
%A A074299 _Jon Perry_, Sep 21 2002
%E A074299 Edited by _Nathaniel Johnston_, May 02 2011