login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A212306
Starting with the positive numbers, each element subtracts its value, a(n), from the next a(n) elements.
3
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, 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, 9, 2, 7, 1, 3, 2, 1, 1, 7, 2, 17, 1, 17, 20, 1, 19, 9, 1, 1
OFFSET
1,3
COMMENTS
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.
a(A258353(n)) = 1; a(A258354(n)) = n and a(m) != n for m < A258354(n). - Reinhard Zumkeller, May 27 2015
LINKS
FORMULA
a(n) is n - the sum of the terms such that a(i) + i >= n.
Each term a(n) is 1 plus the sum of the terms such that a(i) + i + 1 = n.
EXAMPLE
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.
MAPLE
b:= proc(n) option remember; local l, t;
if n=1 then [1$2] else l:= b(n-1); t:= n-l[2];
zip((x, y)->x+y, [t$t+1], subsop(1=NULL, 2=0, l), 0) fi
end:
a:= n-> b(n)[1]:
seq(a(n), n=1..100); # Alois P. Heinz, Nov 12 2013
MATHEMATICA
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 *)
PROG
(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
for(n=1, 100, print1(a(n), ", "))
(PARI) /* Vector returns 1000 terms: */
{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
(Haskell)
a212306 n = a212306_list !! (n-1)
a212306_list = f [1..] where
f (x:xs) = x : f ((map (subtract x) us) ++ vs)
where (us, vs) = splitAt x xs
-- Reinhard Zumkeller, Dec 16 2013
CROSSREFS
Generated from A000027.
Sequence in context: A181512 A076019 A071453 * A339708 A080242 A183927
KEYWORD
nonn,nice
AUTHOR
Gabriel Stauth, Oct 26 2013
STATUS
approved