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.

A378170 Number of subsets of the first n nonzero tetrahedral numbers whose sum is a nonzero tetrahedral number.

Original entry on oeis.org

1, 2, 3, 5, 7, 8, 11, 13, 19, 34, 45, 72, 113, 171, 262, 388, 638, 1128, 1928, 3370, 5584, 9691, 17129, 30493, 54785, 94510, 169817, 308491, 559176, 1019487, 1816043, 3333698, 6153695, 11384025, 21100254, 38262081, 71096456, 132675454, 247900732, 463959984
Offset: 1

Views

Author

Ilya Gutkovskiy, Nov 18 2024

Keywords

Examples

			a(8) = 13 subsets: {1}, {4}, {10}, {20}, {35}, {56}, {84}, {120}, {1, 20, 35}, {1, 35, 84}, {10, 35, 120}, {1, 4, 10, 20} and {1, 4, 20, 56, 84}.
		

Crossrefs

Programs

  • Python
    from sympy import integer_nthroot
    def is_tetra(n): return (c:=integer_nthroot(6*n, 3)[0])*(c+1)*(c+2) == 6*n
    from functools import cache
    @cache
    def b(n, s):
        if n == 0:
            if s > 0 and is_tetra(s): return 1
            return 0
        return b(n-1, s) + b(n-1, s+n*(n+1)*(n+2)//6)
    a = lambda n: b(n, 0)
    print([a(n) for n in range(1, 30)]) # Michael S. Branicky, Nov 18 2024

Extensions

a(24) and beyond from Michael S. Branicky, Nov 18 2024

A378961 Number of sets of nonzero triangular numbers whose largest element is the n-th triangular number and whose sum is a triangular number.

Original entry on oeis.org

1, 1, 2, 1, 3, 5, 5, 11, 19, 33, 55, 92, 192, 327, 579, 1142, 2052, 3776, 6936, 12964, 24308, 44432, 84763, 159299, 299093, 567295, 1075570, 2045580, 3883453, 7411014, 14164089, 27044407, 51759660, 99259961, 190371661, 365537357, 702901278, 1352868238, 2606296357
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 12 2024

Keywords

Examples

			a(5) = 3 subsets of triangular numbers whose largest element is A000217(5)=15 and whose sum is in A000217: {15}, {6, 15} and {3, 10, 15}.
		

Crossrefs

Cf. A000217, A339612, A339613, A377123 (partial sums).

Programs

  • Maple
    istri:= proc(n) issqr(1+8*n) end proc:
    tri:= n -> n*(n+1)/2:
    F:= proc(n,s) option remember; local v;
      if s = 0 then return 1 fi;
      if s > n*(n+1)*(n+2)/6 then return 0 fi;
      v:= tri(n);
      if s >= v then procname(n-1,s-v) + procname(n-1,s)
      else procname(n-1,s)
      fi;
    end proc:
    f:= proc(n) local i,t,m;
       t:= 0;
       m:= n*(n+1)*(n+2)/6;
       for i from 1 while tri(i) <= m do
         t:= t + F(n,tri(i)) - F(n-1,tri(i))
       od;
       t
    end proc:
    map(f, [$1..50]); # Robert Israel, Jan 13 2025

A379337 Number of subsets of the first n nonzero n-gonal numbers whose sum is a nonzero n-gonal number.

Original entry on oeis.org

3, 4, 5, 7, 7, 10, 11, 18, 20, 23, 31, 63, 77, 127, 212, 332, 569, 1034, 1749, 2961, 5236, 9319, 16524, 28583, 53618, 96310, 174573, 309344, 584500, 1077230, 1984982, 3532258, 6791403, 12564409, 23445306, 42349391, 81321728, 152375491, 284898585, 524549566, 1006478176, 1894215667
Offset: 2

Views

Author

Ilya Gutkovskiy, Dec 21 2024

Keywords

Examples

			a(3) = 4 subsets: {1}, {3}, {6}, {1, 3, 6}.
a(4) = 5 subsets: {1}, {4}, {9}, {16}, {9, 16}.
a(5) = 7 subsets: {1}, {5}, {12}, {22}, {35}, {1, 12, 22}, {1, 12, 22, 35}.
		

Crossrefs

Programs

  • Python
    from functools import cache
    from itertools import count, takewhile
    def ngonal(n, k): return k*((n-2)*k - (n-4))//2
    def a(n):
        @cache
        def b(i, s):
            if i == 0: return 1 if s > 0 and s in ISNGONAL else 0
            return b(i-1, s) + b(i-1, s+NGONAL[i-1])
        NGONAL = [ngonal(n, i) for i in range(1, n+1)]
        BOUND = sum(NGONAL)
        ISNGONAL = set(takewhile(lambda x: x<=BOUND, (ngonal(n, i) for i in count(1))))
        b.cache_clear()
        return b(n, 0)
    print([a(n) for n in range(2, 23)]) # Michael S. Branicky, Dec 21 2024

Extensions

a(2) inserted and a(23) and beyond from Michael S. Branicky, Dec 21 2024
Showing 1-3 of 3 results.