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.

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

A163974 Number of ways to write n as the root-mean-square (RMS) of a set of distinct primes.

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 1, 0, 2, 0, 3, 0, 7, 0, 3, 3, 11, 1, 11, 2, 11, 3, 37, 0, 44, 18, 52, 24, 103, 50, 147, 52, 214, 170, 475, 229, 711, 375, 1116, 587, 2101, 542, 3009, 1940, 4870, 1680, 8961, 5923, 16712, 4190, 24098, 11552, 42715, 11347, 69608, 32495, 103914, 50493, 189499, 103581, 304367, 152520, 453946, 203153, 783817, 246991, 1345661
Offset: 1

Views

Author

Alois P. Heinz, Aug 07 2009

Keywords

Examples

			a(13) = 7 because 13 is the RMS of 7 sets of distinct primes: 13 = RMS(13) = RMS(7,17) = RMS(5,11,19) = RMS(7,13,17) = RMS(5,11,13,19) = RMS(5,7,11,17,19) = RMS(5,7,11,13,17,19).
		

Crossrefs

Programs

  • Haskell
    a163974 n = f a000040_list 1 nn 0 where
       f (p:ps) l nl xx
         | yy > nl   = 0
         | yy < nl   = f ps (l + 1) (nl + nn) yy + f ps 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 + p * p
       nn = n ^ 2
    -- Reinhard Zumkeller, Feb 13 2013
  • Maple
    sps:= proc(i) option remember; `if`(i=1, 4, sps(i-1) +ithprime(i)^2) end: b:= proc(n, i, t) if n<0 then 0 elif n=0 then `if`(t=0, 1, 0) elif i=2 then `if`(n=4 and t=1, 1, 0) else b(n, i, t):= b(n, prevprime(i), t) +b(n-i^2, prevprime(i), t-1) fi end: a:= proc(n) option remember; local s, k; s:= `if`(isprime(n), 1, 0); for k from 2 while sps(k)<=k*n^2 do s:= s +b(k*n^2, nextprime(floor(sqrt(k*n^2 -sps(k-1)))-1), k) od; s end: seq(a(n), n=1..30);
  • Mathematica
    sps[i_] := sps[i] = If[i == 1, 4, sps[i - 1] + Prime[i]^2]; b[n_, i_, t_] := b[n, i, t] = If[ n < 0 , 0 , If[ n == 0 , If[t == 0, 1, 0], If[ i == 2 , If[n == 4 && t == 1, 1, 0], b[n, NextPrime[i, -1], t] + b[n - i^2, NextPrime[i, -1], t - 1]]]]; a[n_] := a[n] = (s = Boole[PrimeQ[n]]; For[k = 2, sps[k] <= k*n^2, k++, s = s + b[k*n^2, NextPrime[ Floor[ Sqrt[k*n^2 - sps[k - 1]]] - 1], k]]; s); Table[ Print[a[n]]; a[n], {n, 1, 58}] (* Jean-François Alcover, Jul 11 2012, translated from Maple *)

Extensions

Terms a(59)-a(67) by Reinhard Zumkeller, Feb 13 2013

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

Original entry on oeis.org

1, 0, 1, 0, 3, 0, 3, 0, 9, 1, 19, 2, 59, 13, 161, 50, 413, 123, 1201, 352, 3463, 689, 10921, 1585, 35365, 5409, 110773, 20950, 359725, 82702, 1192801, 320873, 3998397, 1096384, 13584075, 3417934, 45973713, 10657777, 157515581, 33447019, 543663919, 111463220
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 13 2013

Keywords

Examples

			a(5) = 3: 5 = RMS(5) = RMS(1,7) = RMS(1,5,7);
a(7) = 3: 7 = RMS(7) = RMS(1,5,11) = RMS(1,5,7,11);
a(9) = 9: 9 = RMS(9) = RMS(5,7,13) = RMS(5,7,9,13) = RMS(3,5,11,13) = RMS(3,5,9,11,13) = RMS(1,3,7,11,15) = RMS(1,3,7,9,11,15) = RMS(1,3,5,17) = RMS(1,3,5,9,17);
a(10) = 1: 10 = RMS(1,3,5,7,9,11,15,17);
a(11) = 19: 11 = RMS(11) = RMS(3,9,13,15) = RMS(3,9,11,13,15) = RMS(5,7,17) = RMS(5,7,11,17) = RMS(1,5,13,17) = RMS(1,5,11,13,17) = RMS(1,3,9,15,17) = RMS(1,3,9,11,15,17) = RMS(3,5,7,9,13,15,17) = RMS(3,5,7,9,11,13,15,17) = RMS(1,5,7,13,19) = RMS(1,5,7,11,13,19) = RMS(1,3,7,9,15,19) = RMS(1,3,7,9,11,15,19) = RMS(3,5,7,9,21) = RMS(3,5,7,9,11,21) = RMS(1,3,5,9,13,21) = RMS(1,3,5,9,11,13,21);
a(12) = 2: 12 = RMS(1,5,7,9,11,15,17,19) = RMS(1,3,5,7,9,13,17,23).
		

Crossrefs

Programs

  • Haskell
    a211868 n = f a005408_list 1 nn 0 where
       f (o:os) l nl xx
         | yy > nl   = 0
         | yy < nl   = f os (l + 1) (nl + nn) yy + f os 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 + o * o
       nn = n ^ 2

Extensions

a(37)-a(40) from Alois P. Heinz, Feb 25 2013
a(41)-a(42) from Alois P. Heinz, May 03 2015
Showing 1-3 of 3 results.