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.

A212306 Starting with the positive numbers, each element subtracts its value, a(n), from the next a(n) elements.

This page as a plain text file.
%I A212306 #38 May 27 2015 14:36:12
%S A212306 1,1,2,2,1,3,4,1,1,5,2,5,1,3,2,6,1,11,2,1,1,4,8,1,1,2,6,1,3,13,1,9,5,
%T A212306 7,1,1,2,2,6,3,3,17,1,17,5,7,1,1,2,2,6,3,3,8,1,4,5,7,1,18,6,18,14,1,1,
%U A212306 9,2,7,1,3,2,1,1,7,2,17,1,17,20,1,19,9,1,1
%N A212306 Starting with the positive numbers, each element subtracts its value, a(n), from the next a(n) elements.
%C A212306 When calculating this sequence, each element affects a different number of subsequent terms, so there is no known direct formula for the n-th term.
%C A212306 a(A258353(n)) = 1; a(A258354(n)) = n and a(m) != n for m < A258354(n). - _Reinhard Zumkeller_, May 27 2015
%H A212306 Paul D. Hanna, <a href="/A212306/b212306.txt">Table of n, a(n) for n = 1..10000</a>
%F A212306 a(n) is n - the sum of the terms such that a(i) + i >= n.
%F A212306 Each term a(n) is 1 plus the sum of the terms such that a(i) + i + 1 = n.
%e A212306 Starting with A000027, the first term is 1 so we subtract 1 from the next 1 terms so the second term becomes 1. Now again we subtract 1 from the next 1 terms and the third term becomes 2. Subtract 2 from the next two terms of A000027 (4 and 5) to get 2 and 3. Subtract 2 from the next 2 terms (the 3 from 5 and 6) to get 1 and 4. The next term is 4 - 1 = 3. To carry on subtract 3 from the next 3 terms.
%p A212306 b:= proc(n) option remember; local l, t;
%p A212306       if n=1 then [1$2] else l:= b(n-1); t:= n-l[2];
%p A212306       zip((x, y)->x+y, [t$t+1], subsop(1=NULL, 2=0, l), 0) fi
%p A212306     end:
%p A212306 a:= n-> b(n)[1]:
%p A212306 seq(a(n), n=1..100);  # _Alois P. Heinz_, Nov 12 2013
%t A212306 b[n_] := b[n] = Module[{l, t, x, y, m}, If[n == 1, {1, 1}, l = b[n-1]; t = n-l[[2]]; x = Array[t&, t+1]; y = ReplacePart[l, {1 -> Sequence[], 2 -> 0}]; m = Max[Length[x], Length[y]]; Thread[PadRight[x, m] + PadRight[y, m]]]]; a[n_] := b[n] // First; Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Jan 27 2014, after _Alois P. Heinz_ *)
%o A212306 (PARI) {a(n)=local(A=vector(n+1,j,j)); for(k=1,n+1, A = Vec(Ser(A) - x^k*A[k]*(1-x^A[k])/(1-x) +x*O(x^n)));A[n]} \\ _Paul D. Hanna_, Nov 12 2013
%o A212306 for(n=1,100,print1(a(n),", "))
%o A212306 (PARI) /* Vector returns 1000 terms: */
%o A212306 {A=vector(1000,j,j);for(k=1,#A, A = Vec(Ser(A) - x^k*A[k]*(1-x^A[k])/(1-x) +x*O(x^#A)));A} \\ _Paul D. Hanna_, Nov 12 2013
%o A212306 (Haskell)
%o A212306 a212306 n = a212306_list !! (n-1)
%o A212306 a212306_list = f [1..] where
%o A212306    f (x:xs) = x : f ((map (subtract x) us) ++ vs)
%o A212306               where (us, vs) = splitAt x xs
%o A212306 -- _Reinhard Zumkeller_, Dec 16 2013
%Y A212306 Generated from A000027.
%Y A212306  Cf. A258353, A258354.
%K A212306 nonn,nice
%O A212306 1,3
%A A212306 _Gabriel Stauth_, Oct 26 2013