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.

Showing 1-2 of 2 results.

A008344 a(1)=0; thereafter a(n+1) = a(n) - n if a(n) >= n otherwise a(n+1) = a(n) + n.

Original entry on oeis.org

0, 1, 3, 0, 4, 9, 3, 10, 2, 11, 1, 12, 0, 13, 27, 12, 28, 11, 29, 10, 30, 9, 31, 8, 32, 7, 33, 6, 34, 5, 35, 4, 36, 3, 37, 2, 38, 1, 39, 0, 40, 81, 39, 82, 38, 83, 37, 84, 36, 85, 35, 86, 34, 87, 33, 88, 32, 89, 31, 90, 30, 91, 29, 92, 28, 93, 27, 94, 26, 95, 25, 96, 24, 97, 23, 98
Offset: 1

Views

Author

Keywords

Comments

p^a(n) = A084110(p^(n-1)) for n>1 and p prime. - Reinhard Zumkeller, May 12 2003
For n > 1: a(A029858(n)) = A029858(n) and a(A003462(n)) = 0. - Reinhard Zumkeller, May 09 2012
Absolute first differences of A085059; abs(a(n+1)-a(n)) = n, see also A086283. - Reinhard Zumkeller, Oct 17 2014
For n>3, when a(n) = 3, a(n+1) is in A116970. - Bill McEachen, Oct 03 2023

Crossrefs

Equals A085059(n)-1.
Cf. A076042 (based on squares).

Programs

  • Haskell
    a008344 n = a008344_list !! (n-1)
    a008344_list = 0 : f 0 [1..] where
       f x (z:zs) = y : f y zs where y = if x < z then x + z else x - z
    -- Reinhard Zumkeller, Oct 17 2014, May 08 2012
    
  • Maple
    A008344 := proc(n) option remember; if n = 0 then 0 elif A008344(n-1) >= (n-1) then A008344(n-1)-(n-1) else A008344(n-1)+(n-1); fi; end;
  • Mathematica
    a[1]=0; a[n_] := a[n]=If[a[n-1]>=n-1, a[n-1]-n+1, a[n-1]+n-1]
    Transpose[ NestList[ If[First[#]>=Last[#],{First[#]-Last[#],Last[#]+1}, {First[#]+Last[#],Last[#]+1}]&,{0,1},80]][[1]] (* Harvey P. Dale, Jun 20 2011 *)
    s = 0; Table[If[s < n, s = s + n, s = s - n], {n, 0, 80}] (* Horst H. Manninger, Dec 03 2018 *)
  • PARI
    a(n) = my(expo = logint(2*n+1, 3), res = n - (3^expo-1)/2); if(res==0, 0, if(res%2, (3^expo-res)/2, 3^expo-1+res/2)) \\ Jianing Song, May 25 2021

Formula

This is a concatenation S_0, S_1, S_2, ... where S_i = [b_0, b_1, ..., b_{3^(i+1)-1}] with b_0 = 0, b_{2j-1} = k+1-j, b_{2j} = 2k+j (j=1..k), k=(3^(i+1)-1)/2. E.g. S_0 = [0, 1, 3], S_1 = [0, 4, 9, 3, 10, 2, 11, 1, 12].
a((3^n-1)/2) = 0; a((3^n-1)/2 + 2k-1) = (3^n+1)/2 - k for 1 <= k <= (3^n-1)/2; a((3^n-1)/2 + 2k) = 3^n - 1 + k for 1 <= k < (3^n-1)/2. - Benoit Cloitre, Jan 09 2003 [Corrected by Jianing Song, May 25 2021]
a(n) = (n-1+a(n-1)) mod (2*(n-1)). - Jon Maiga, Jul 09 2021

Extensions

Name edited by Dmitry Kamenetsky, Feb 14 2017

A050407 a(n) = n*(n^2 - 6*n + 11)/6.

Original entry on oeis.org

0, 1, 1, 1, 2, 5, 11, 21, 36, 57, 85, 121, 166, 221, 287, 365, 456, 561, 681, 817, 970, 1141, 1331, 1541, 1772, 2025, 2301, 2601, 2926, 3277, 3655, 4061, 4496, 4961, 5457, 5985, 6546, 7141, 7771, 8437, 9140, 9881, 10661, 11481, 12342, 13245, 14191
Offset: 0

Views

Author

Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Dec 22 1999

Keywords

Comments

Number of invertible shuffles of n-2 cards. - Adam C. McDougall (mcdougal(AT)stolaf.edu) and David Molnar (molnar(AT)stolaf.edu), Apr 09 2002
If Y is a 3-subset of an n-set X then, for n>=3, a(n-2) is the number of (n-3)-subsets of X which have neither one element nor two elements in common with Y. - Milan Janjic, Dec 28 2007
Let A be the Hessenberg n X n matrix defined by: A[1,j]=j mod 2, A[i,i]:=1, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=4, a(n+1)=-coeff(charpoly(A,x),x^(n-3)). - Milan Janjic, Jan 24 2010
Starting with offset 3: (1, 2, 5, 11, 21, ...) = triangle A144257 * [1,2,3,...]. - Gary W. Adamson, Feb 18 2010
(1 + 2x + 5x^2 + 11x^3 + ...) = (1 + 2x + 3x^2 + ...)*(1 + 2x^2 + 3x^3 + ...). - Gary W. Adamson, Jul 26 2010
Starting (1, 2, 5, 11, ...) = binomial transform of [1, 1, 2, 1, 0, 0, 0, ...]. - Gary W. Adamson, Aug 25 2010
For n > 1: abs(abs(a(n+2) - a(n+1)) - abs(a(n+1) - a(n))) = n - 1; see also A086283. - Reinhard Zumkeller, Oct 17 2014
For n > 0, a(n) is the number of valid hook configurations of permutations of [n-1] that avoid the patterns 132 and 321. - Colin Defant, Apr 28 2019
For n >= 1, a(n+2) is the number of Grassmannian permutations that avoid a pattern, sigma, where sigma is a pattern of size 4 with exactly one descent. - Jessica A. Tomasko, Nov 15 2022
The number of bigrassmannian permutations in S_n is a(n+2) = binomial(n+1, 3) + 1. - Joshua Swanson, Jan 08 2024

Crossrefs

Apart from initial terms, one more than the tetrahedral numbers A000292.

Programs

Formula

From Paul Barry, Jul 21 2003: (Start)
Diagonal sums of square array A086460 (starting 1, 1, 2, ...).
a(n+2) = 1 + n*(n+1)*(n-1)/6 = Sum_{k=0..n} (0^k + (n-k)*k). (End)
a(n) = binomial(n-1,3) + binomial(n-1,0), n>=0. - Zerinvary Lajos, Jul 24 2006
G.f.: x*(1-3*x+3*x^2)/(1-x)^4. - Colin Barker, May 06 2012
a(n) = 4*a(n-1) - 6*a(n-2) + 4*a(n-3) - a(n-4). - Vincenzo Librandi, Jun 22 2012
a(n) = A000292(n-3) + 1, n > 2. - Ivan N. Ianakiev, Apr 27 2014
E.g.f.: x*(6 - 3*x + x^2)*exp(x)/6. - G. C. Greubel, Oct 30 2019
a(n+2) = 1 + Sum_{i=3..4} binomial(n, i-1) for n >= 1. - Jessica A. Tomasko, Nov 15 2022
Showing 1-2 of 2 results.