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

A300190 Number of solutions to 1 +- 2 +- 3 +- ... +- n == 0 (mod n).

Original entry on oeis.org

1, 0, 2, 4, 4, 0, 10, 32, 30, 0, 94, 344, 316, 0, 1096, 4096, 3856, 0, 13798, 52432, 49940, 0, 182362, 699072, 671092, 0, 2485534, 9586984, 9256396, 0, 34636834, 134217728, 130150588, 0, 490853416, 1908874584, 1857283156, 0, 7048151672, 27487790720
Offset: 1

Views

Author

Seiichi Manyama, Feb 28 2018

Keywords

Comments

Apparently a(2*n + 1) = A053656(2*n + 1) for n >= 0. - Georg Fischer, Mar 26 2019

Examples

			Solutions for n = 7:
--------------------------
1 +2 +3 +4 +5 +6 +7 =  28.
1 +2 +3 +4 +5 +6 -7 =  14.
1 +2 -3 +4 -5 -6 +7 =   0.
1 +2 -3 +4 -5 -6 -7 = -14.
1 +2 -3 -4 +5 +6 +7 =  14.
1 +2 -3 -4 +5 +6 -7 =   0.
1 -2 +3 +4 -5 +6 +7 =  14.
1 -2 +3 +4 -5 +6 -7 =   0.
1 -2 -3 -4 -5 +6 +7 =   0.
1 -2 -3 -4 -5 +6 -7 = -14.
		

Crossrefs

Number of solutions to 1 +- 2^k +- 3^k +- ... +- n^k == 0 (mod n): this sequence (k=1), A300268 (k=2), A300269 (k=3).
Cf. A016825 (4n+2).

Programs

  • Maple
    b:= proc(n, i, m) option remember; `if`(i=0, `if`(n=0, 1, 0),
          add(b(irem(n+j, m), i-1, m), j=[i, m-i]))
        end:
    a:= n-> b(0, n-1, n):
    seq(a(n), n=1..60);  # Alois P. Heinz, Mar 01 2018
  • Mathematica
    b[n_, i_, m_] := b[n, i, m] = If[i == 0, If[n == 0, 1, 0], Sum[b[Mod[n + j, m], i - 1, m], {j, {i, m - i}}]];
    a[n_] := b[0, n - 1, n];
    Array[a, 60] (* Jean-François Alcover, Apr 29 2020, after Alois P. Heinz *)
  • Ruby
    def A(n)
      ary = [1] + Array.new(n - 1, 0)
      (1..n).each{|i|
        i1 = 2 * i
        a = ary.clone
        (0..n - 1).each{|j| a[(j + i1) % n] += ary[j]}
        ary = a
      }
      ary[(n * (n + 1) / 2) % n] / 2
    end
    def A300190(n)
      (1..n).map{|i| A(i)}
    end
    p A300190(100)

Formula

a(4*n+1) = A000016(n), a(4*n+2) = 0, a(4*n+3) = A000016(n), a(4*n+4) = 2 * A000016(n) for n > 0.
a(2^n) = 2^A000325(n) for n > 1.

A300269 Number of solutions to 1 +- 8 +- 27 +- ... +- n^3 == 0 (mod n).

Original entry on oeis.org

1, 0, 2, 4, 4, 0, 20, 48, 80, 0, 94, 344, 424, 0, 1096, 4864, 3856, 0, 16444, 52432, 65248, 0, 182362, 720928, 671104, 0, 4152320, 11156656, 9256396, 0, 34636834, 135397376, 130150588, 0, 533834992, 2773200896, 1857304312, 0, 7065319328, 27541477824, 26817356776
Offset: 1

Views

Author

Seiichi Manyama, Mar 01 2018

Keywords

Examples

			Solutions for n = 7:
-----------------------------------
1 +8 +27 +64 +125 +216 +343 =  784.
1 +8 +27 +64 +125 +216 -343 =   98.
1 +8 +27 -64 +125 -216 +343 =  224.
1 +8 +27 -64 +125 -216 -343 = -462.
1 +8 +27 -64 -125 +216 +343 =  406.
1 +8 +27 -64 -125 +216 -343 = -280.
1 +8 -27 -64 +125 +216 +343 =  602.
1 +8 -27 -64 +125 +216 -343 =  -84.
1 -8 +27 +64 +125 -216 +343 =  336.
1 -8 +27 +64 +125 -216 -343 = -350.
1 -8 +27 +64 -125 +216 +343 =  518.
1 -8 +27 +64 -125 +216 -343 = -168.
1 -8 +27 -64 -125 -216 +343 =  -42.
1 -8 +27 -64 -125 -216 -343 = -728.
1 -8 -27 +64 +125 +216 +343 =  714.
1 -8 -27 +64 +125 +216 -343 =   28.
1 -8 -27 -64 +125 -216 +343 =  154.
1 -8 -27 -64 +125 -216 -343 = -532.
1 -8 -27 -64 -125 +216 +343 =  336.
1 -8 -27 -64 -125 +216 -343 = -350.
		

Crossrefs

Number of solutions to 1 +- 2^k +- 3^k +- ... +- n^k == 0 (mod n): A300190 (k=1), A300268 (k=2), this sequence (k=3).

Programs

  • Maple
    b:= proc(n, i, m) option remember; `if`(i=0, `if`(n=0, 1, 0),
          add(b(irem(n+j, m), i-1, m), j=[i^3, m-i^3]))
        end:
    a:= n-> b(0, n-1, n):
    seq(a(n), n=1..60);  # Alois P. Heinz, Mar 01 2018
  • Mathematica
    b[n_, i_, m_] := b[n, i, m] = If[i == 0, If[n == 0, 1, 0],
         Sum[b[Mod[n + j, m], i - 1, m], {j, {i^3, m - i^3}}]];
    a[n_] := b[0, n - 1, n];
    Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Mar 19 2022, after Alois P. Heinz *)
  • PARI
    a(n) = my (v=vector(n,k,k==1)); for (i=2, n, v = vector(n, k, v[1 + (k-i^3)%n] + v[1 + (k+i^3)%n])); v[1] \\ Rémy Sigrist, Mar 01 2018
  • Ruby
    def A(n)
      ary = [1] + Array.new(n - 1, 0)
      (1..n).each{|i|
        i3 = 2 * i * i * i
        a = ary.clone
        (0..n - 1).each{|j| a[(j + i3) % n] += ary[j]}
        ary = a
      }
      ary[((n * (n + 1)) ** 2 / 4) % n] / 2
    end
    def A300269(n)
      (1..n).map{|i| A(i)}
    end
    p A300269(100)
    

Extensions

More terms from Alois P. Heinz, Mar 01 2018
Showing 1-2 of 2 results.