login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A212306 Starting with the positive numbers, each element subtracts its value, a(n), from the next a(n) elements. 3

%I #38 May 27 2015 14:36:12

%S 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 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 9,2,7,1,3,2,1,1,7,2,17,1,17,20,1,19,9,1,1

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

%C 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 a(A258353(n)) = 1; a(A258354(n)) = n and a(m) != n for m < A258354(n). - _Reinhard Zumkeller_, May 27 2015

%H Paul D. Hanna, <a href="/A212306/b212306.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) is n - the sum of the terms such that a(i) + i >= n.

%F Each term a(n) is 1 plus the sum of the terms such that a(i) + i + 1 = n.

%e 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 b:= proc(n) option remember; local l, t;

%p if n=1 then [1$2] else l:= b(n-1); t:= n-l[2];

%p zip((x, y)->x+y, [t$t+1], subsop(1=NULL, 2=0, l), 0) fi

%p end:

%p a:= n-> b(n)[1]:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Nov 12 2013

%t 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 (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 for(n=1,100,print1(a(n),", "))

%o (PARI) /* Vector returns 1000 terms: */

%o {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 (Haskell)

%o a212306 n = a212306_list !! (n-1)

%o a212306_list = f [1..] where

%o f (x:xs) = x : f ((map (subtract x) us) ++ vs)

%o where (us, vs) = splitAt x xs

%o -- _Reinhard Zumkeller_, Dec 16 2013

%Y Generated from A000027.

%Y Cf. A258353, A258354.

%K nonn,nice

%O 1,3

%A _Gabriel Stauth_, Oct 26 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)