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-10 of 13 results. Next

A238122 Irregular triangle read by rows: T(n,k) gives the number of ballot sequences of length n having k descents, n>=0, 0<=k<=A083920(n-1).

Original entry on oeis.org

1, 1, 2, 3, 1, 5, 5, 7, 16, 3, 11, 43, 21, 1, 15, 99, 101, 17, 22, 215, 373, 145, 9, 30, 430, 1174, 836, 146, 4, 42, 834, 3337, 3846, 1324, 112, 1, 56, 1529, 8642, 15002, 8786, 1615, 66, 77, 2765, 21148, 52132, 47013, 15403, 1582, 32, 101, 4792, 48713, 164576, 214997, 112106, 21895, 1310, 14
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 21 2014

Keywords

Comments

Same as A238121, with zeros omitted.
T(2n,n) gives A241804.
T(2n+1,n) gives A241805.
Row sums are A000085.
T(n*(n+1)/2,n*(n-1)/2) = 1.

Examples

			T(5,0) = 7: [1,1,1,1,1], [1,1,1,1,2], [1,1,1,2,2], [1,1,1,2,3], [1,1,2,2,3], [1,1,2,3,4], [1,2,3,4,5].
T(5,1) = 16: [1,1,1,2,1], [1,1,2,1,1], [1,1,2,1,2], [1,1,2,1,3], [1,1,2,2,1], [1,1,2,3,1], [1,1,2,3,2], [1,2,1,1,1], [1,2,1,1,2], [1,2,1,1,3], [1,2,1,2,3], [1,2,1,3,4], [1,2,3,1,1], [1,2,3,1,2], [1,2,3,1,4], [1,2,3,4,1].
T(5,2) = 3: [1,2,1,2,1], [1,2,1,3,1], [1,2,1,3,2].
Triangle starts:
00:   1;
01:   1;
02:   2;
03:   3,    1;
04:   5,    5;
05:   7,   16,      3;
06:  11,   43,     21,      1;
07:  15,   99,    101,     17;
08:  22,  215,    373,    145,      9;
09:  30,  430,   1174,    836,    146,      4;
10:  42,  834,   3337,   3846,   1324,    112,      1;
11:  56, 1529,   8642,  15002,   8786,   1615,     66;
12:  77, 2765,  21148,  52132,  47013,  15403,   1582,    32;
13: 101, 4792,  48713, 164576, 214997, 112106,  21895,  1310,  14;
14: 135, 8216, 108147, 484609, 874413, 672015, 215849, 26159, 932, 5;
...
		

Programs

  • Maple
    b:= proc(n, v, l) option remember; `if`(n<1, 1, expand(
          add(`if`(i=1 or l[i-1]>l[i], `if`(i(p->seq(coeff(p, x, i), i=0..degree(p)))(b(n-1, 1, [1])):
    seq(T(n), n=0..14);
  • Mathematica
    b[n_, v_, l_List] := b[n, v, l] = If[n<1, 1, Expand[Sum[If[i == 1 || l[[i-1]] > l[[i]], If[i l[[i]]+1]], 0], {i, 1, Length[ l ]}] + b[n-1, Length[l]+1, Append[l, 1]]]]; T[n_] := Function[{p}, Table[ Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n-1, 1, {1}]]; Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Feb 11 2015, after Maple *)

A002024 k appears k times; a(n) = floor(sqrt(2n) + 1/2).

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13
Offset: 1

Views

Author

Keywords

Comments

Integer inverse function of the triangular numbers A000217. The function trinv(n) = floor((1+sqrt(1+8n))/2), n >= 0, gives the values 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, ..., that is, the same sequence with offset 0. - N. J. A. Sloane, Jun 21 2009
Array T(k,n) = n+k-1 read by antidiagonals.
Eigensequence of the triangle = A001563. - Gary W. Adamson, Dec 29 2008
Can apparently also be defined via a(n+1)=b(n) for n >= 2 where b(0)=b(1)=1 and b(n) = b(n-b(n-2))+1. Tested to be correct for all n <= 150000. - José María Grau Ribas, Jun 10 2011
For any n >= 0, a(n+1) is the least integer m such that A000217(m)=m(m+1)/2 is larger than n. This is useful when enumerating representations of n as difference of triangular numbers; see also A234813. - M. F. Hasler, Apr 19 2014
Number of binary digits of A023758, i.e., a(n) = ceiling(log_2(A023758(n+2))). - Andres Cicuttin, Apr 29 2016
a(n) and A002260(n) give respectively the x(n) and y(n) coordinates of the sorted sequence of points in the integer lattice such that x(n) > 0, 0 < y(n) <= x(n), and min(x(n), y(n)) < max(x(n+1), y(n+1)) for n > 0. - Andres Cicuttin, Dec 25 2016
Partial sums (A060432) are given by S(n) = (-a(n)^3 + a(n)*(1+6n))/6. - Daniel Cieslinski, Oct 23 2017
As an array, T(k,n) is the number of digits columns used in carryless multiplication between a k-digit number and an n-digit number. - Stefano Spezia, Sep 24 2022
a(n) is the maximum number of possible solutions to an n-statement Knights and Knaves Puzzle, where each statement is of the form "x of us are knights" for some 1 <= x <= n, knights can only tell the truth and knaves can only lie. - Taisha Charles and Brittany Ohlinger, Jul 29 2023

Examples

			From _Clark Kimberling_, Sep 16 2008: (Start)
As a rectangular array, a northwest corner:
  1 2 3 4 5 6
  2 3 4 5 6 7
  3 4 5 6 7 8
  4 5 6 7 8 9
This is the weight array (cf. A144112) of A107985 (formatted as a rectangular array). (End)
G.f. = x + 2*x^2 + 2*x^3 + 3*x^4 + 3*x^5 + 3*x^6 + 4*x^7 + 4*x^9 + 4*x^9 + 4*x^10 + ...
		

References

  • Edward S. Barbeau, Murray S. Klamkin, and William O. J. Moser, Five Hundred Mathematical Challenges, Prob. 441, pp. 41, 194. MAA 1995.
  • R. L. Graham, D. E. Knuth, and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 97.
  • K. Hardy and K. S. Williams, The Green Book of Mathematical Problems, p. 59, Solution to Prob. 14, Dover NY, 1985
  • R. Honsberger, Mathematical Morsels, pp. 133-134, MAA 1978.
  • J. F. Hurley, Litton's Problematical Recreations, pp. 152; 313-4 Prob. 22, VNR Co., NY, 1971.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 1, p. 43.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.

Crossrefs

a(n+1) = 1+A003056(n), A022846(n)=a(n^2), a(n+1)=A002260(n)+A025581(n).
A123578 is an essentially identical sequence.

Programs

  • Haskell
    a002024 n k = a002024_tabl !! (n-1) !! (k-1)
    a002024_row n = a002024_tabl !! (n-1)
    a002024_tabl = iterate (\xs@(x:_) -> map (+ 1) (x : xs)) [1]
    a002024_list = concat a002024_tabl
    a002024' = round . sqrt . (* 2) . fromIntegral
    -- Reinhard Zumkeller, Jul 05 2015, Feb 12 2012, Mar 18 2011
    
  • Haskell
    a002024_list = [1..] >>= \n -> replicate n n
    
  • Haskell
    a002024 = (!!) $ [1..] >>= \n -> replicate n n
    -- Sascha Mücke, May 10 2016
    
  • Magma
    [Floor(Sqrt(2*n) + 1/2): n in [1..80]]; // Vincenzo Librandi, Nov 19 2014
    
  • Maple
    A002024 := n-> ceil((sqrt(1+8*n)-1)/2); seq(A002024(n), n=1..100);
  • Mathematica
    a[1] = 1; a[n_] := a[n] = a[n - a[n - 1]] + 1 (* Branko Curgus, May 12 2009 *)
    Table[n, {n, 13}, {n}] // Flatten (* Robert G. Wilson v, May 11 2010 *)
    Table[PadRight[{},n,n],{n,15}]//Flatten (* Harvey P. Dale, Jan 13 2019 *)
  • PARI
    t1(n)=floor(1/2+sqrt(2*n)) /* A002024 = this sequence */
    
  • PARI
    t2(n)=n-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1) */
    
  • PARI
    t3(n)=binomial(floor(3/2+sqrt(2*n)),2)-n+1 /* A004736 */
    
  • PARI
    t4(n)=n-1-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1)-1 */
    
  • PARI
    A002024(n)=(sqrtint(n*8)+1)\2 \\ M. F. Hasler, Apr 19 2014
    
  • PARI
    a(n)=(sqrtint(8*n-7)+1)\2
    
  • PARI
    a(n)=my(k=1);while(binomial(k+1,2)+1<=n,k++);k \\ R. J. Cano, Mar 17 2014
    
  • Python
    from math import isqrt
    def A002024(n): return (isqrt(8*n)+1)//2 # Chai Wah Wu, Feb 02 2022
  • Sage
    [floor(sqrt(2*n) +1/2) for n in (1..80)] # G. C. Greubel, Dec 10 2018
    

Formula

a(n) = floor(1/2 + sqrt(2n)). Also a(n) = ceiling((sqrt(1+8n)-1)/2). [See the Liu link for a large collection of explicit formulas. - N. J. A. Sloane, Oct 30 2019]
a((k-1)*k/2 + i) = k for k > 0 and 0 < i <= k. - Reinhard Zumkeller, Aug 30 2001
a(n) = a(n - a(n-1)) + 1, with a(1)=1. - Ian M. Levitt (ilevitt(AT)duke.poly.edu), Aug 18 2002
a(n) = round(sqrt(2n)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 01 2002
T(n,k) = A003602(A118413(n,k)); = T(n,k) = A001511(A118416(n,k)). - Reinhard Zumkeller, Apr 27 2006
G.f.: (x/(1-x))*Product_{k>0} (1-x^(2*k))/(1-x^(2*k-1)). - Vladeta Jovovic, Oct 06 2003
Equals A127899 * A004736. - Gary W. Adamson, Feb 09 2007
Sum_{i=1..n} Sum_{j=i..n+i-1} T(j,i) = A000578(n); Sum_{i=1..n} T(n,i) = A000290(n). - Reinhard Zumkeller, Jun 24 2007
a(n) + n = A014132(n). - Vincenzo Librandi, Jul 08 2010
a(n) = ceiling(-1/2 + sqrt(2n)). - Branko Curgus, May 12 2009
a(A169581(n)) = A038567(n). - Reinhard Zumkeller, Dec 02 2009
a(n) = round(sqrt(2*n)) = round(sqrt(2*n-1)); there exist a and b greater than zero such that 2*n = 2+(a+b)^2 -(a+3*b) and a(n)=(a+b-1). - Fabio Civolani (civox(AT)tiscali.it), Feb 23 2010
A005318(n+1) = 2*A005318(n) - A205744(n), A205744(n) = A005318(A083920(n)), A083920(n) = n - a(n). - N. J. A. Sloane, Feb 11 2012
Expansion of psi(x) * x / (1 - x) in powers of x where psi() is a Ramanujan theta function. - Michael Somos, Mar 19 2014
G.f.: (x/(1-x)) * Product_{n>=1} (1 + x^n) * (1 - x^(2*n)). - Paul D. Hanna, Feb 27 2016
a(n) = 1 + Sum_{i=1..n/2} ceiling(floor(2(n-1)/(i^2+i))/(2n)). - José de Jesús Camacho Medina, Jan 07 2017
a(n) = floor((sqrt(8*n-7)+1)/2). - Néstor Jofré, Apr 24 2017
a(n) = floor((A000196(8*n)+1)/2). - Pontus von Brömssen, Dec 10 2018
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 (A003881). - Amiram Eldar, Oct 01 2022
G.f. as array: (x^2*(1 - y)^2 + y^2 + x*y*(1 - 2*y))/((1 - x)^2*(1 - y)^2). - Stefano Spezia, Apr 22 2024

A005318 Conway-Guy sequence: a(n + 1) = 2a(n) - a(n - floor( 1/2 + sqrt(2n) )).

Original entry on oeis.org

0, 1, 2, 4, 7, 13, 24, 44, 84, 161, 309, 594, 1164, 2284, 4484, 8807, 17305, 34301, 68008, 134852, 267420, 530356, 1051905, 2095003, 4172701, 8311101, 16554194, 32973536, 65679652, 130828948, 261127540, 521203175, 1040311347, 2076449993, 4144588885, 8272623576
Offset: 0

Views

Author

Keywords

Comments

Conway and Guy conjecture that the set of k numbers {s_i = a(k) - a(k-i) : 1 <= i <= k} has the property that all its subsets have distinct sums - see Guy's book. These k-sets are the rows of A096858. [This conjecture has apparently now been proved by Bohman. - I. Halupczok (integerSequences(AT)karimmi.de), Feb 20 2006]

References

  • J. H. Conway and R. K. Guy, Solution of a problem of Erdos, Colloq. Math. 20 (1969), p. 307.
  • R. K. Guy, Unsolved Problems in Number Theory, C8.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • M. Wald, Problem 1192, Unequal sums, J. Rec. Math., 15 (No. 2, 1983-1984), pp. 148-149.

Crossrefs

A276661 is the main entry for the distinct subset sums problem.

Programs

  • Haskell
    a005318 n = a005318_list !! n
    a005318_list = 0 : 1 : zipWith (-)
       (map (* 2) $ tail a005318_list) (map a005318 a083920_list)
    -- Reinhard Zumkeller, Feb 12 2012
    
  • Mathematica
    a[n_] := a[n] = 2*a[n-1] - a[n - Floor[Sqrt[2]*Sqrt[n-1] + 1/2] - 1]; a[0]=0; a[1]=1; Table[a[n], {n, 0, 33}] (* Jean-François Alcover, May 15 2013 *)
  • PARI
    a(n)=if(n<=1,n==1,2*a(n-1)-a(n-1-(sqrtint(8*n-15)+1)\2))
    
  • PARI
    A=[]; /* This is the program above with memoization. */
    a(n)=if(n<3, return(n)); if(n>#A, A=concat(A,vector(n-#A)), if(A[n], return(A[n]))); A[n]=2*a(n-1)-a(n-1-(sqrtint(8*n-15)+1)\2) \\ Charles R Greathouse IV, Sep 09 2016
    
  • Python
    from sympy import sqrt, floor
    def a(n): return n if n<2 else 2*a(n - 1) - a(n - floor(sqrt(2)*sqrt(n - 1) + 1/2) - 1) # Indranil Ghosh, Jun 03 2017

Formula

a(n+1) = 2*a(n)-A205744(n), A205744(n) = a(A083920(n)), A083920(n) = n - A002024(n). - N. J. A. Sloane, Feb 11 2012

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 21 2000

A270953 Number T(n,k) of set partitions of [n] having exactly k pairs (m,m+1) such that m+1 is in some block b and m is in block b+1; triangle T(n,k), n>=0, 0<=k<=n-floor((1+sqrt(max(0,8n-7)))/2), read by rows.

Original entry on oeis.org

1, 1, 2, 4, 1, 9, 6, 25, 24, 3, 84, 91, 27, 1, 323, 374, 159, 21, 1377, 1699, 857, 197, 10, 6412, 8410, 4726, 1421, 174, 4, 32312, 44794, 27385, 9573, 1783, 127, 1, 174941, 254718, 167097, 64724, 15158, 1856, 76, 1011357, 1538027, 1071422, 449567, 121464, 20074, 1650, 36
Offset: 0

Views

Author

Alois P. Heinz, Mar 26 2016

Keywords

Examples

			T(3,1) = 1: 13|2.
T(4,1) = 6: 124|3, 134|2, 13|24, 13|2|4, 14|23, 1|24|3.
T(5,2) = 3: 135|24, 13|25|4, 15|24|3.
T(6,3) = 1: 136|25|4.
T(7,3) = 21: 1247|36|5, 1347|26|5, 1357|246, 135|247|6, 137|246|5, 1367|25|4, 136|257|4, 136|25|47, 136|25|4|7, 137|256|4, 13|257|46, 13|25|47|6, 137|26|45, 13|27|46|5, 147|236|5, 157|246|3, 15|247|36, 15|24|37|6, 17|246|35, 1|247|36|5, 17|26|35|4.
T(8,4) = 10: 1358|247|6, 1368|257|4, 136|258|47, 136|25|48|7, 138|257|46, 13|258|47|6, 138|27|46|5, 158|247|36, 15|248|37|6, 18|247|36|5.
T(9,5) = 4: 1369|258|47, 136|259|48|7, 139|258|47|6, 159|248|37|6.
T(10,6) = 1: 136(10)|259|48|7.
Triangle T(n,k) begins:
00 :      1;
01 :      1;
02 :      2;
03 :      4,     1;
04 :      9,     6;
05 :     25,    24,     3;
06 :     84,    91,    27,    1;
07 :    323,   374,   159,   21;
08 :   1377,  1699,   857,  197,   10;
09 :   6412,  8410,  4726, 1421,  174,   4;
10 :  32312, 44794, 27385, 9573, 1783, 127,  1;
		

Crossrefs

Row sums give A000110.
T(2n,n) gives A270965.
Last terms of rows give A270967.

Programs

  • Maple
    b:= proc(n, i, m) option remember; expand(`if`(n=0, 1, add(
           b(n-1, j, max(m, j))*`if`(j=i-1, x, 1), j=1..m+1)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 1, 0)):
    seq(T(n), n=0..14);
  • Mathematica
    b[n_, i_, m_] := b[n, i, m] = Expand[If[n == 0, 1, Sum[b[n - 1, j, Max[m, j]]*If[j == i - 1, x, 1], {j, 1, m + 1}]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 1, 0]]; Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Dec 12 2016, after Alois P. Heinz *)

Formula

T(A000217(n+1),A000217(n)) = 1 for n>=0.
T(A000217(n+1)-1,A000217(n)-1) = 1+n for n>=1.
T(A000217(n+1)-2,A000217(n)-2) = A000217(1+n) for n>=2.

A342557 T(n,m) is the number of unlabeled connected graphs without endpoints on m nodes with n edges, where T(n,m), m <= n, is a triangle read by rows.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0, 3, 5, 1, 0, 0, 0, 0, 2, 11, 8, 1, 0, 0, 0, 0, 1, 15, 31, 12, 1, 0, 0, 0, 0, 1, 12, 63, 71, 16, 1, 0, 0, 0, 0, 0, 8, 89, 231, 144, 21, 1, 0, 0, 0, 0, 0, 5, 97, 513, 707, 274, 27, 1
Offset: 1

Views

Author

Hugo Pfoertner, May 21 2021

Keywords

Comments

The number of nonzero terms in the n-th row is A083920(n-1). - Hugo Pfoertner, Feb 01 2024

Examples

			The triangle begins
  0;
  0, 0;
  0, 0, 1;
  0, 0, 0, 1;
  0, 0, 0, 1, 1;
  0, 0, 0, 1, 3,  1;
  0, 0, 0, 0, 3,  5,  1;
  0, 0, 0, 0, 2, 11,  8,  1;
  0, 0, 0, 0, 1, 15, 31, 12,  1;
  0, 0, 0, 0, 1, 12, 63, 71, 16, 1;
		

Crossrefs

Cf. A004108 (column sums), A342556 (row sums).
Cf. A083920, A369932 (not necessarily connected).

Programs

  • PARI
    \\ Needs G() defined in A369932.
    InvEulerMTS(p)={my(n=serprec(p, x)-1, q=log(p), vars=variables(p)); sum(i=1, n, moebius(i)*substvec(q + O(x*x^(n\i)), vars, apply(v->v^i, vars))/i)}
    T(n)={my(r=Vec(InvEulerMTS(substvec(G(n),[x,y],[y,x])))); vector(#r-1, i, Vecrev(Pol(r[i+1]/y),i)) }
    { my(A=T(12)); for(i=1, #A, print(A[i])) } \\ Andrew Howroyd, Feb 07 2024

Formula

Bivariate inverse Euler transform of A369932. - Andrew Howroyd, Feb 07 2024

A363757 Lexicographically earliest sequence of positive integers such that the n-th pair of consecutive equal values are separated by a(n) distinct terms, with pairs numbered according to the position of the second term in the pair.

Original entry on oeis.org

1, 2, 1, 3, 2, 3, 4, 1, 3, 2, 5, 4, 5, 3, 4, 6, 1, 5, 2, 6, 4, 7, 3, 7, 5, 3, 1, 4, 8, 2, 1, 6, 3, 2, 3, 8, 9, 7, 8, 7, 1, 9, 7, 8, 5, 10, 4, 3, 2, 9, 2, 6, 8, 7, 3, 11, 1, 8, 3, 1, 10, 3, 6, 9, 7, 3, 12, 5, 12, 8, 3, 8, 2, 12, 9, 1, 7, 12, 13, 4, 9, 11, 8, 4, 2, 8, 10, 1, 10, 13, 6
Offset: 1

Views

Author

Neal Gersh Tolunsky, Jun 23 2023

Keywords

Comments

The word 'distinct' differentiates this sequence from A363654.
A000124 gives the index of the first occurrence of n, and A080036 gives the indices of the remaining terms. A record high term occurs when its corresponding pair number would be the previous record high, since that would have to use all terms between the enclosing pair, which is impossible.
A083920(n) gives the number of pairs in the first n terms of this sequence.
If pairs are numbered according to the position of the first term in the pair (rather than second), this becomes A001511 (the ruler function).

Examples

			The 1st pair (1,2,1) encloses 1 term because a(1)=1.
The 2nd pair (2,1,3,2) encloses 2 distinct terms because a(2)=2.
The 3rd pair (3,2,3) encloses 1 term because a(3)=1.
The 4th pair (1,3,2,3,4,1) encloses 3 distinct terms because a(4)=3.
a(4)=3 since if we place a 1 or a 2 (creating the second pair), this would enclose less than a(2)=2 distinct terms, so a(4) must be the smallest unused number, which is 3.
		

Crossrefs

A205744 The sequence "u_{n-r}" used by Conway and Guy in the construction of A005318 and A096858.

Original entry on oeis.org

0, 0, 1, 1, 2, 4, 4, 7, 13, 24, 24, 44, 84, 161, 309, 309, 594, 1164, 2284, 4484, 8807, 8807, 17305, 34301, 68008, 134852, 267420, 530356, 530356, 1051905, 2095003, 4172701, 8311101, 16554194, 32973536, 65679652, 65679652, 130828948, 261127540, 521203175, 1040311347, 2076449993
Offset: 1

Views

Author

N. J. A. Sloane, Feb 09 2012

Keywords

Comments

This is A005318 with the terms A005318(i) repeated iff i is a triangular number.

Crossrefs

Formula

A005318(n+1) = 2*A005318(n)-A205744(n), A205744(n) = A005318(A083920(n)), A083920(n) = n - A002024(n). - N. J. A. Sloane, Feb 11 2012

A274404 Number T(n,k) of modified skew Dyck paths of semilength n with exactly k anti-down steps; triangle T(n,k), n>=0, 0<=k<=n-floor((1+sqrt(max(0,8n-7)))/2), read by rows.

Original entry on oeis.org

1, 1, 2, 5, 1, 14, 6, 42, 28, 3, 132, 120, 28, 1, 429, 495, 180, 20, 1430, 2002, 990, 195, 10, 4862, 8008, 5005, 1430, 165, 4, 16796, 31824, 24024, 9009, 1650, 117, 1, 58786, 125970, 111384, 51688, 13013, 1617, 70, 208012, 497420, 503880, 278460, 89180, 16016, 1386, 35
Offset: 0

Views

Author

Alois P. Heinz, Jun 20 2016

Keywords

Comments

A modified skew Dyck path is a path in the first quadrant which begins at the origin, ends on the x-axis, consists of steps U=(1,1) (up), D=(1,-1) (down) and A=(-1,1) (anti-down) so that A and D steps do not overlap.

Examples

			              /\
              \ \
T(3,1) = 1:   /  \
.
Triangle T(n,k) begins:
:     1;
:     1;
:     2;
:     5,     1;
:    14,     6;
:    42,    28,     3;
:   132,   120,    28,    1;
:   429,   495,   180,   20;
:  1430,  2002,   990,  195,   10;
:  4862,  8008,  5005, 1430,  165,   4;
: 16796, 31824, 24024, 9009, 1650, 117, 1;
		

Crossrefs

Columns k=0-3 give: A000108, A002694(n-1), A074922(n-2), A232224(n-3).
Row sums give A230823.
Last elements of rows give A092392(n-1) for n>0.

Programs

  • Maple
    b:= proc(x, y, t, n) option remember; expand(`if`(y>n, 0,
          `if`(n=y, `if`(t=2, 0, 1), b(x+1, y+1, 0, n-1)+
          `if`(t<>1 and x>0, b(x-1, y+1, 2, n-1)*z, 0)+
          `if`(t<>2 and y>0, b(x+1, y-1, 1, n-1), 0))))
        end:
    T:= n-> (p-> seq(coeff(p, z, i), i=0..degree(p)))(b(0$3, 2*n)):
    seq(T(n), n=0..14);
  • Mathematica
    b[x_, y_, t_, n_] := b[x, y, t, n] = Expand[If[y > n, 0,
         If[n == y, If[t == 2, 0, 1], b[x + 1, y + 1, 0, n - 1] +
         If[t != 1 && x > 0, b[x - 1, y + 1, 2, n - 1] z, 0] +
         If[t != 2 && y > 0, b[x + 1, y - 1, 1, n - 1], 0]]]];
    T[n_] := CoefficientList[b[0, 0, 0, 2n], z];
    T /@ Range[0, 14] // Flatten (* Jean-François Alcover, Mar 27 2021, after Alois P. Heinz *)

Formula

Sum_{k>0} k * T(n,k) = A274405(n).

A220347 Permutation of natural numbers: a(1) = 1, a(triangular(n)) = (2*a(n))-1, a(nontriangular(n)) = 2*n, where triangular = A000217, nontriangular = A014132.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 8, 12, 10, 7, 16, 24, 20, 14, 11, 32, 48, 40, 28, 22, 9, 64, 96, 80, 56, 44, 18, 15, 128, 192, 160, 112, 88, 36, 30, 23, 256, 384, 320, 224, 176, 72, 60, 46, 19, 512, 768, 640, 448, 352, 144, 120, 92, 38, 13, 1024, 1536, 1280, 896, 704, 288
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 12 2012

Keywords

Comments

Inverse permutation of A183079, when seen as a flattened sequence.

Crossrefs

Inverse: A183079.
Cf. also a similar permutation A257797 from which this differs for the first time at n=15, where a(15) = 11, while A257797(15) = 9.

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a220347 =  (+ 1) . fromJust . (`elemIndex` a183079_list)
    
  • Mathematica
    a[n_] := a[n] = With[{r = (-1 + Sqrt[8n + 1])/2}, Which[n <= 1, n, IntegerQ[r], 2 a[Floor[Sqrt[2n] + 1/2]] - 1, True, 2 a[n - Floor[r]]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Dec 05 2021 *)
  • Scheme
    ;; With memoizing definec-macro.
    (definec (A220347 n) (cond ((<= n 1) n) ((zero? (A010054 n)) (* 2 (A220347 (A083920 n)))) (else (+ -1 (* 2 (A220347 (A002024 n)))))))
    ;; Antti Karttunen, May 18 2015

Formula

a(1) = 1; for n > 1: if A010054(n) = 1 [i.e., if n is triangular], then a(n) = (2*a(A002024(n)))-1, otherwise a(n) = 2*a(A083920(n)). - Antti Karttunen, May 18 2015

Extensions

Old name moved to comments by Antti Karttunen, May 18 2015

A096796 a(n) = n for n <= 2; for n > 2, a(n) = 2a(n-1) - a(n - floor( 1/2 + sqrt(2n) )).

Original entry on oeis.org

0, 1, 2, 3, 5, 8, 13, 23, 41, 74, 135, 257, 491, 941, 1808, 3481, 6827, 13397, 26303, 51665, 101522, 199563, 395645, 784463, 1555529, 3084755, 6117845, 12134168, 24068773, 47937983, 95480321, 190176179, 378796829, 754508903, 1502899961
Offset: 0

Views

Author

N. J. A. Sloane, Aug 17 2004

Keywords

Crossrefs

Programs

  • Haskell
    a096796 n = a096796_list !! n
    a096796_list = 0 : 1 : zipWith (-)
       (map (* 2) $ tail a096796_list) (map a096796 $ tail a083920_list)
    -- Reinhard Zumkeller, Feb 12 2012
  • Mathematica
    a[n_] := a[n] = If[n < 3, a[n] = n, 2a[n - 1] - a[n - Floor[1/2 + Sqrt[2n]] ]]; Table[ a[n], {n, 0, 35}] (* Robert G. Wilson v *)
  • PARI
    {m=35;v=vector(m+1);for(n=0,m,if(n<=2,a=n,k=n-floor(1/2+sqrt(2*n));a=2*v[n]-v[k+1]);v[n+1]=a;print1(a,","))} \\ Klaus Brockhaus, Aug 20 2004
    

Extensions

More terms from Klaus Brockhaus and Robert G. Wilson v, Aug 20 2004
Showing 1-10 of 13 results. Next