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.

Previous Showing 21-23 of 23 results.

A350695 Number of solutions to +-2 +- 3 +- 5 +- 7 +- ... +- prime(n-1) = n.

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 1, 1, 4, 5, 9, 15, 26, 45, 77, 137, 243, 434, 774, 1408, 2554, 4667, 8627, 15927, 29559, 54867, 101688, 189425, 355315, 668598, 1264180, 2395462, 4506221, 8507311, 16084405, 30545142, 57898862, 110199367, 209957460, 400430494, 765333684
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 29 2022

Keywords

Crossrefs

Programs

  • Mathematica
    Table[SeriesCoefficient[Product[x^Prime[k] + 1/x^Prime[k], {k, n - 1}], {x, 0, n}], {n, 0, 40}] (* Stefano Spezia, Jan 30 2022 *)
  • Python
    from sympy import sieve, primerange
    from functools import cache
    @cache
    def b(n, i):
        maxsum = 0 if i < 2 else sum(p for p in primerange(2, sieve[i-1]+1))
        if n > maxsum: return 0
        if i < 2: return 1
        return b(n+sieve[i-1], i-1) + b(abs(n-sieve[i-1]), i-1)
    def a(n): return b(n, n)
    print([a(n) for n in range(41)]) # Michael S. Branicky, Jan 29 2022

Formula

a(n) = [x^n] Product_{k=1..n-1} (x^prime(k) + 1/x^prime(k)).

A379451 Number of ordered ways of writing 0 as Sum_{k=-n..n} e(k)*k, where e(k) is 0 or 1.

Original entry on oeis.org

2, 10, 162, 6278, 430906, 46032666, 7029940154, 1453778429782, 390651831405906, 132345369222827306, 55150093300481888770, 27727437337790844360198, 16545310955942988999292586, 11561068480810074519638819626, 9349537740123803513263001013354, 8664632430514446774520557369434870
Offset: 0

Views

Author

Ilya Gutkovskiy, Dec 23 2024

Keywords

Examples

			a(1) = 10 ways: {}, {0}, {-1, 1} (2 permutations), {-1, 0, 1} (6 permutations).
		

Crossrefs

Programs

  • Python
    from math import factorial
    from functools import cache
    @cache
    def b(i, s, c):
        if i == 0: return factorial(c) if s == 0 else 0
        return b(i-1, s, c) + b(i-1, s+(i>>1)*(-1)**(i&1), c+1)
    def a(n): return b(2*n+1, 0, 0)
    print([a(n) for n in range(16)]) # Michael S. Branicky, Dec 23 2024

Extensions

a(9) and beyond from Michael S. Branicky, Dec 23 2024

A113035 Number of ways the set {1,2,...,n} can be split into two subsets of which the sum of one is twice the sum of the other.

Original entry on oeis.org

0, 1, 1, 0, 3, 4, 0, 10, 17, 0, 46, 78, 0, 231, 401, 0, 1233, 2177, 0, 6869, 12268, 0, 39502, 71172, 0, 232686, 422076, 0, 1396669, 2547246, 0, 8512170, 15593760, 0, 52534875, 96598865, 0, 327669853, 604405633, 0, 2062171364, 3814087419, 0, 13078921499
Offset: 1

Views

Author

Floor van Lamoen, Oct 11 2005

Keywords

Examples

			For n=5 we have 5/1234, 14/532 and 23/541 so a(5)=3.
		

Crossrefs

Programs

  • Maple
    A113035:= proc(n) local i,j,p,t; t:= NULL; for j to n do p:=1; for i to j do p:=p*(x^(-2*i)+x^(i)); od; t:=t,coeff(p,x,0); od; t; end;
    # second Maple program:
    b:= proc(n, i) option remember; local m; m:= i*(i+1)/2;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i), i-1) +b(n+i, i-1)))
        end:
    a:= n-> `if`(irem(n, 3)=1, 0, b(n*(n+1)/6, n)):
    seq(a(n), n=1..60);  # Alois P. Heinz, Oct 31 2011
  • Mathematica
    b[n_, i_] := b[n, i] = Module[{m = i(i+1)/2}, If[n > m, 0, If[n == m, 1, b[Abs[n - i], i - 1] + b[n + i, i - 1]]]];
    a[n_] := If[Mod[n, 3] == 1, 0, b[n(n+1)/6, n]];
    Array[a, 60] (* Jean-François Alcover, Nov 18 2020, after Alois P. Heinz *)

Formula

a(n) is the coefficient of x^0 in Product_{k=1..n} x^(-2k)+x^k.
Previous Showing 21-23 of 23 results.