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

A339507 Number of subsets of {1..n} whose sum is a decimal palindrome.

Original entry on oeis.org

1, 2, 4, 8, 15, 24, 32, 41, 55, 79, 126, 220, 406, 778, 1524, 3057, 6310, 13211, 27500, 56246, 113003, 224220, 442106, 870323, 1715503, 3391092, 6726084, 13382357, 26686192, 53286329, 106469764, 212803832, 425434124, 850676115, 1701169724, 3402169203, 6804150711, 13608072837, 27215890383, 54431527170
Offset: 0

Views

Author

Ilya Gutkovskiy, Dec 07 2020

Keywords

Examples

			a(5) = 24 subsets: {}, {1}, {2}, {3}, {4}, {5}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}, {3, 4}, {3, 5}, {4, 5}, {1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5}, {2, 3, 4}, {2, 4, 5} and {1, 2, 3, 5}.
		

Crossrefs

Programs

  • Python
    from itertools import combinations
    def a(n):
        ans = 0
        for r in range(n+1):
            for s in combinations(range(1,n+1),r):
                strss = str(sum(s))
                ans += strss==strss[::-1]
        return ans
    print([a(n) for n in range(21)]) # Michael S. Branicky, Dec 07 2020
    
  • Python
    from functools import lru_cache
    from itertools import combinations
    @lru_cache(maxsize=None)
    def A339507(n):
        pallist = set(i for i in range(1,n*(n+1)//2+1) if str(i) == str(i)[::-1])
        return 1 if n == 0 else A339507(n-1) + sum(sum(d)+n in pallist for i in range(n) for d in combinations(range(1,n),i)) # Chai Wah Wu, Dec 08 2020
    
  • Python
    from functools import lru_cache
    def cond(s): ss = str(s); return ss == ss[::-1]
    @lru_cache(maxsize=None)
    def b(n, s):
        if n == 0: return int(cond(s))
        return b(n-1, s) + b(n-1, s+n)
    a = lambda n: b(n, 0)
    print([a(n) for n in range(100)]) # Michael S. Branicky, Oct 05 2022

Extensions

a(23)-a(36) from Michael S. Branicky, Dec 08 2020
a(37)-a(39) from Chai Wah Wu, Dec 11 2020

A339554 Number of subsets of {1..n} whose sum is a perfect power.

Original entry on oeis.org

1, 1, 2, 5, 9, 15, 25, 48, 99, 187, 326, 543, 896, 1497, 2568, 4554, 8504, 17074, 36011, 75842, 153964, 298835, 561337, 1044317, 1968266, 3796589, 7448571, 14648620, 28541211, 54900185, 104612044, 198620706, 377264405, 717303565, 1363083731, 2585928327
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 08 2020

Keywords

Examples

			a(6) = 15 subsets: {1}, {4}, {1, 3}, {2, 6}, {3, 5}, {3, 6}, {4, 5}, {1, 2, 5}, {1, 2, 6}, {1, 3, 4}, {1, 3, 5}, {2, 3, 4}, {1, 4, 5, 6}, {2, 3, 5, 6} and {1, 2, 3, 4, 6}.
		

Crossrefs

Programs

  • Python
    from sympy import perfect_power
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def b(n, s, c):
      if n == 0:
        if c > 0 and (s==1 or perfect_power(s)): return 1
        return 0
      return b(n-1, s, c) + b(n-1, s+n, c+1)
    a = lambda n: b(n, 0, 0)
    print([a(n) for n in range(1, 37)]) # Michael S. Branicky, Dec 10 2020

Extensions

a(25)-a(36) from Alois P. Heinz, Dec 08 2020

A378171 Number of subsets of the first n positive cubes whose sum is a positive cube.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 11, 12, 18, 23, 32, 42, 67, 99, 150, 247, 391, 635, 1098, 1865, 2927, 4932, 9109, 14825, 26926, 48452, 83758, 148387, 263258, 468595, 840912, 1559322, 2785642, 5146754, 9454946, 16756330, 31372080, 57754175, 105385375, 196773661, 368705288, 671572482
Offset: 1

Views

Author

Ilya Gutkovskiy, Nov 18 2024

Keywords

Examples

			a(8) = 11 subsets: {1}, {8}, {27}, {64}, {125}, {216}, {343}, {512}, {1, 216, 512}, {27, 64, 125} and {1, 27, 64, 125, 512}.
		

Crossrefs

Programs

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

Extensions

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

A339615 Number of nonempty sets of distinct positive integers whose sum of cubes is a cube, the largest integer of a set is n.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 1, 6, 5, 9, 10, 25, 32, 51, 97, 144, 244, 463, 767, 1062, 2005, 4177, 5716, 12101, 21526, 35306, 64629, 114871, 205337, 372317, 718410, 1226320, 2361112, 4308192, 7301384, 14615750, 26382095, 47631200, 91388286, 171931627, 302867194, 578843590, 1112232587
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 10 2020

Keywords

Examples

			a(13) = 10 sets: {13}, {2, 3, 8, 13}, {4, 8, 11, 12, 13}, {1, 2, 6, 7, 11, 13}, {2, 5, 7, 8, 12, 13}, {3, 4, 8, 10, 11, 12, 13}, {1, 2, 3, 4, 5, 7, 11, 13}, {2, 3, 4, 6, 7, 8, 9, 13}, {1, 2, 5, 6, 7, 8, 9, 10, 12, 13} and {2, 3, 5, 7, 8, 9, 10, 11, 12, 13}.
		

Crossrefs

Programs

  • Python
    from functools import lru_cache
    def perf_cube(n): return round(n**(1/3))**3 ==n
    @lru_cache(maxsize=None)
    def b(n, soc, c):
      if n == 0:
        if perf_cube(soc): return 1
        return 0
      return b(n-1, soc, c) + b(n-1, soc+n*n*n, c+1)
    a = lambda n: b(n-1, n*n*n, 1)
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Dec 10 2020

Extensions

a(24)-a(41) from Michael S. Branicky, Dec 10 2020
a(42)-a(45) from Alois P. Heinz, Dec 11 2020
Showing 1-4 of 4 results.