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-3 of 3 results.

A126257 Number of distinct new terms in row n of Pascal's triangle.

Original entry on oeis.org

1, 0, 1, 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 7, 5, 7, 8, 9, 9, 9, 8, 11, 11, 12, 12, 13, 13, 13, 14, 15, 15, 16, 16, 17, 16, 17, 18, 19, 19, 20, 20, 21, 21, 22, 21, 23, 23, 24, 24, 25, 25, 26, 26, 27, 26, 26, 28, 29, 29, 30, 30, 31, 31, 32, 32, 32, 33, 34, 34, 34, 35, 36, 36, 37, 37, 38
Offset: 0

Views

Author

Nick Hobson, Dec 24 2006

Keywords

Comments

Partial sums are in A126256.
n occurs a(n) times in A265912. - Reinhard Zumkeller, Dec 18 2015

Examples

			Row 6 of Pascal's triangle is: 1, 6, 15, 20, 15, 6, 1. Of these terms, only 15 and 20 do not appear in rows 0-5. Hence a(6)=2.
		

Crossrefs

Programs

  • Haskell
    import Data.List.Ordered (minus, union)
    a126257 n = a126257_list !! n
    a126257_list = f [] a034868_tabf where
       f zs (xs:xss) = (length ys) : f (ys `union` zs) xss
                       where ys = xs `minus` zs
    -- Reinhard Zumkeller, Dec 18 2015
    
  • PARI
    lim=77; z=listcreate(1+lim^2\4); print1(1, ", "); r=1; for(a=1, lim, for(b=1, a\2, s=Str(binomial(a, b)); f=setsearch(z, s, 1); if(f, listinsert(z, s, f))); print1(1+#z-r, ", "); r=1+#z)
    
  • Python
    def A126257(n):
        if n:
            s, c = (1,), {1}
            for i in range(n-1):
                c.update(set(s:=(1,)+tuple(s[j]+s[j+1] for j in range(len(s)-1))+(1,)))
            return len(set((1,)+tuple(s[j]+s[j+1] for j in range(len(s)-1))+(1,))-c)
        return 1 # Chai Wah Wu, Oct 17 2023

A126256 Number of distinct terms in rows 0 through n of Pascal's triangle.

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 9, 12, 16, 20, 24, 29, 35, 41, 48, 53, 60, 68, 77, 86, 95, 103, 114, 125, 137, 149, 162, 175, 188, 202, 217, 232, 248, 264, 281, 297, 314, 332, 351, 370, 390, 410, 431, 452, 474, 495, 518, 541, 565, 589, 614, 639, 665, 691, 718, 744, 770, 798
Offset: 0

Views

Author

Nick Hobson, Dec 24 2006

Keywords

Comments

An easy upper bound is 1 + floor(n^2/4) = A033638(n).
First differences are in A126257.

Examples

			There are 9 distinct terms in rows 0 through 6 of Pascal's triangle (1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 6, 4, 1, 1, 5, 10, 10, 5, 1, 1, 6, 15, 20, 15, 6, 1); hence a(6)=9.
		

Crossrefs

Programs

  • Haskell
    -- import Data.List.Ordered (insertSet)
    a126256 n = a126256_list !! n
    a126256_list = f a007318_tabl [] where
       f (xs:xss) zs = g xs zs where
         g []     ys = length ys : f xss ys
         g (x:xs) ys = g xs (insertSet x ys)
    -- Reinhard Zumkeller, May 26 2015, Nov 09 2011
    
  • Maple
    seq(nops(`union`(seq({seq(binomial(n,k),k=0..n)},n=0..m))),m=0..57); # Emeric Deutsch, Aug 26 2007
  • Mathematica
    Table[Length[Union[Flatten[Table[Binomial[n,k],{n,0,x},{k,0,n}]]]],{x,0,60}] (* Harvey P. Dale, Sep 10 2022 *)
  • PARI
    lim=57; z=listcreate(1+lim^2\4); for(n = 0, lim, for(r=1, n\2, s=Str(binomial(n, r)); f=setsearch(z, s, 1); if(f, listinsert(z, s, f))); print1(1+#z, ", "))
    
  • Python
    def A126256(n):
        s, c = (1,), {1}
        for i in range(n):
            s = (1,)+tuple(s[j]+s[j+1] for j in range(len(s)-1)) + (1,)
            c.update(set(s))
        return len(c) # Chai Wah Wu, Oct 17 2023

A126254 Number of distinct terms i^j for 1 <= i,j <= n.

Original entry on oeis.org

1, 3, 7, 11, 19, 28, 40, 50, 60, 76, 96, 115, 139, 163, 189, 207, 239, 270, 306, 340, 378, 417, 461, 503, 539, 585, 621, 670, 726, 779, 839, 881, 941, 1003, 1067, 1113, 1185, 1254, 1326, 1397, 1477, 1553, 1637, 1717, 1799, 1884, 1976, 2063, 2135, 2225
Offset: 1

Views

Author

Nick Hobson, Dec 24 2006

Keywords

Comments

An easy upper bound is n(n-1)+1 = A002061(n).

Examples

			a(4) = 11, as there are 11 distinct terms in 1^1=1, 1^2=1, 1^3=1, 1^4=1, 2^1=2, 2^2=4, 2^3=8, 2^4=16, 3^1=3, 3^2=9, 3^3=27, 3^4=81, 4^1=4, 4^2=16, 4^3=64, 4^4=256.
		

Crossrefs

Programs

  • Maple
    seq(nops({seq(seq(i^j, i=1..n),j=1..n)}),n=1..100); # Robert Israel, Feb 23 2015
  • PARI
    lim=50; z=listcreate(lim*(lim-1)+1); for(m=1, lim, for(i=1, m, x=factor(i); x[, 2]*=m; s=Str(x); f=setsearch(z, s, 1); if(f, listinsert(z, s, f))); t=factor(m); for(j=1, m, x=t; x[, 2]=j*t[, 2]; s=Str(x); f=setsearch(z, s, 1); if(f, listinsert(z, s, f))); print1(#z, ", "))
    
  • Python
    def A126254(n): return len({i**j for i in range(1,n+1) for j in range(1,n+1)}) # Chai Wah Wu, Oct 17 2023
  • R
    A126254 <- function(limit) {  if (limit == 1) { return(1) } ; num.powers <- c(1, rep(0, limit-1)) ; handled <- c(T, rep(F, limit-1)) ; for (base in 2:ceiling(sqrt(limit))) { if (!handled[base]) { num.handle <- floor(log(limit, base)) ; handled[base^(1:num.handle)] <- T ; num.powers[base] <- length(unique(as.vector(outer(1:num.handle, 1:limit)))) }} ; num.powers[!handled] <- limit ; sum(num.powers) } ; A126254(50) # John Silberholz, Feb 23 2015
    
Showing 1-3 of 3 results.