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.

A066571 Number of sets of positive integers with arithmetic mean n.

Original entry on oeis.org

1, 3, 9, 31, 117, 479, 2061, 9183, 42021, 196239, 931457, 4480531, 21793257, 107004891, 529656765, 2640160039, 13241371629, 66771501151, 338333343825, 1721768732423, 8796192611917, 45096680384635, 231945566136129, 1196461977291959, 6188390166782849
Offset: 1

Views

Author

Amarnath Murthy, Dec 19 2001

Keywords

Comments

From Franklin T. Adams-Watters, Sep 13 2011: (Start)
If we use nonnegative integers instead of positive integers, we get this sequence shifted left (i.e., with offset 0).
The largest number that can be included in set of positive integers with mean n is the triangular number n*(n+1)/2 = A000217(n).
All values are odd. Sets including n are paired with the same set with n removed, with exception of {n}, as the empty set has no average.
(End)

Examples

			a(2) = 3 as there are three sets viz. {2}, {1,3}, {1,2,3}, each of which has the arithmetic mean 2.
a(3) = 9: the nine sets are {3}, {1, 5}, {2, 4}, {1, 2, 6}, {1, 3, 5}, {2, 3, 4}, {1, 2, 3, 6}, {1, 2, 4, 5}, {1, 2, 3, 4, 5}.
		

Crossrefs

Programs

  • Haskell
    a066571 n = f [1..] 1 n 0 where
       f (k:ks) l nl x
         | y > nl  = 0
         | y < nl  = f ks (l + 1) (nl + n) y + f ks l nl x
         | otherwise = if y `mod` l == 0 then 1 else 0
         where y = x + k
    -- Reinhard Zumkeller, Feb 13 2013
  • Maple
    g := k->expand(mul(1+t*x^i,i=1..k)); A066571 := proc(n) local k; add(coeff(coeff(g(n*k),t,k),x,n*k),k=1..2*n-1); end;
  • Mathematica
    g[k_] := Expand[Product[1 + t*x^i, {i, 1, k}]]; a[n_] := Sum[Coefficient[ Coefficient[g[n*k], t, k], x, n*k], {k, 1, 2*n - 1}]; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 10}] (* Jean-François Alcover, Feb 10 2018, translated from Maple *)

Formula

Sum of coefficient of t^k x^(n*k) in Product_{i=1..n*k} (1+t*x^i) for k <= 2*n-1. - N. J. A. Sloane
From Martin Fuller, Sep 14 2023: (Start)
Constant term in formal Laurent series (Product_{i=1-n..n*(n-1)/2} (1+x^i)) - 1.
a(n) = (Sum_{i=0..n*(n-1)/2} A053632(n-1,i)*A000009(i))*2-1. (End)

Extensions

Corrected and extended by N. J. A. Sloane, Dec 19 2001
More terms from Naohiro Nomoto, Jun 19 2002
More terms from David Wasserman, Sep 10 2002
More terms from Martin Fuller, Sep 14 2023

A164283 Number of ways to write n as the root-mean-square (RMS) of a set of distinct positive integers.

Original entry on oeis.org

1, 1, 1, 1, 3, 9, 19, 79, 225, 693, 1901, 5597, 17641, 57503, 195431, 647139, 2182987, 7344451, 25057681, 85742999, 295284367, 1028155825, 3596134963, 12659796475, 44696280143, 158226554179, 562623263251, 2006471222195, 7182910999719, 25795458946677, 92875047372825, 335362896810137
Offset: 1

Views

Author

Alois P. Heinz, Aug 12 2009

Keywords

Examples

			a(6) = 9, because 6 is the RMS of 9 sets of distinct positive integers: 6 = RMS(6) = RMS(1,3,5,8,9) = RMS(3,4,5,7,9) = RMS(1,2,4,5,7,11) = RMS(1,3,5,6,8,9) = RMS(3,4,5,6,7,9) = RMS(1,2,3,5,7,8,10) = RMS(1,2,4,5,6,7,11) = RMS(1,2,3,5,6,7,8,10).
		

Crossrefs

Programs

  • Haskell
    a164283 n = f [1..] 1 nn 0 where
       f (k:ks) l nl xx
         | yy > nl  = 0
         | yy < nl  = f ks (l + 1) (nl + nn) yy + f ks l nl xx
         | otherwise = if w == n then 1 else 0
         where w = if r == 0 then a000196 m else 0
               (m, r) = divMod yy l
               yy = xx + k * k
       nn = n ^ 2
    -- Reinhard Zumkeller, Feb 13 2013
  • Maple
    sns:= proc(i) option remember; `if`(i=1, 1, sns(i-1) +i^2) end: b:= proc(n, i, t) if n<0 or i
    				
  • Mathematica
    sns[i_] := sns[i] = If[i == 1, 1, sns[i-1] + i^2] ; b[n_, i_, t_] := Which[n < 0 || i < t, 0, n == 0, If[t == 0, 1, 0], i == 1, If[n == 1 && t == 1, 1, 0], True, b[n, i, t] = b[n, i-1, t] + b[n - i^2, i-1, t-1]]; a[n_] := a[n] = Module[{s = 1, k}, For[k = 2, sns[k] <= k*n^2, k++, s = s + b[k*n^2, Floor[Sqrt[k*n^2 - sns[k-1]]], k]]; s]; Table[Print[an = a[n]]; an, {n, 1, 29}] (* Jean-François Alcover, Dec 30 2013, translated from Maple *)
Showing 1-2 of 2 results.