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-9 of 9 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

A072697 Squarefree numbers such that the sum of the prime factors is a multiple of the number of prime factors.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 15, 17, 19, 21, 23, 29, 31, 33, 35, 37, 39, 41, 42, 43, 47, 51, 53, 55, 57, 59, 61, 65, 67, 69, 71, 73, 77, 78, 79, 83, 85, 87, 89, 91, 93, 95, 97, 101, 103, 105, 107, 109, 110, 111, 113, 114, 115, 119, 123, 127, 129, 131, 133, 137, 139, 141, 143
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 04 2002

Keywords

Examples

			42=2*3*7: number of factors = 3 and sum of factors =2+3+7=12, as 12=4*3, 42 is a term: a(19)=42, A072698(19)=3, A072699(19)=12 and A072700(19)=4 contributes 1 count for A072701(4), as (2+3+7)/3=4.
		

Crossrefs

Programs

  • Magma
    [k:k in [2..200]| IsSquarefree(k) and IsIntegral(&+PrimeDivisors(k)/#PrimeDivisors(k))]; // Marius A. Burtea, Nov 14 2019
  • Mathematica
    Select[ Range[2, 143], SquareFreeQ[#] && Divisible[ Tr[ fi = FactorInteger[#][[All, 1]]], Length[fi]]& ](* Jean-François Alcover, Jul 11 2012 *)

A072700 A072698(n) / A072699(n).

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 4, 17, 19, 5, 23, 29, 31, 7, 6, 37, 8, 41, 4, 43, 47, 10, 53, 8, 11, 59, 61, 9, 67, 13, 71, 73, 9, 6, 79, 83, 11, 16, 89, 10, 17, 12, 97, 101, 103, 5, 107, 109, 6, 20, 113, 8, 14, 12, 22, 127, 23, 131, 13, 137, 139, 25, 12, 17, 149, 151, 18, 157, 28, 15
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 04 2002

Keywords

Examples

			a(19) = A072698(19)/A072699(19) = 12/3 = 4.
		

Crossrefs

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

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 *)

A072820 Largest number of distinct primes to represent n as arithmetic mean.

Original entry on oeis.org

1, 1, 3, 3, 5, 4, 5, 5, 7, 6, 9, 8, 9, 9, 11, 10, 11, 11, 13, 12, 13, 13, 15, 14, 17, 15, 17, 16, 17, 17, 19, 18, 19, 19, 21, 20, 23, 21, 23, 22, 23, 23, 25, 24, 25, 25, 27, 26, 27, 27, 29, 28, 29, 28, 29, 29, 31, 30, 31, 31, 33, 32, 33, 33, 35, 33, 35, 34, 37, 35, 37, 36, 37, 37
Offset: 2

Views

Author

Reinhard Zumkeller, Jul 15 2002

Keywords

Examples

			a(20) = 13: (2+3+5+7+11+13+17+19+23+29+31+41+59)/13 = 20. [corrected by _Jean-François Alcover_, Nov 10 2020]
		

Crossrefs

Cf. A072701.

Programs

  • Maple
    sp:= proc(i) option remember; `if`(i=1, 2, sp(i-1) +ithprime(i)) end:
    b:= proc(n, i, t) local h; if n<0 then 0 elif n=0 then `if`(t=0, 1, 0) elif i=2 then `if`(n=2 and t=1, 1, 0) else h := b(n, prevprime(i), t); b(n, i, t):= `if`(h>0, h, b(n-i, prevprime(i), t-1)) fi end:
    a:= proc(n) local i, k; if n<4 then 1 else for k from 2 while sp(k)/k<=n do od: do k:= k-1; if b(k*n, nextprime(k*n -sp(k-1)-1), k)>0 then break fi od; k fi end: seq(a(n), n=2..50); # Alois P. Heinz, Aug 03 2009
  • Mathematica
    sp[i_] := sp[i] = If[i == 1, 2, sp[i - 1] + Prime[i]];
    b[n_, i_, t_] := b[n, i, t] = Module[{h}, Which[n < 0, 0, n == 0, If[t == 0, 1, 0], i == 2, If[n == 2 && t == 1, 1, 0], True, h = b[n, NextPrime[i, -1], t]; If[h > 0, h, b[n - i, NextPrime[i, -1], t - 1]]]];
    a[n_] := a[n] = Module[{k}, If[n < 4, 1, For[k = 2, sp[k]/k <= n, k++]; While[True, k = k - 1; If[b[k n, NextPrime[k n - sp[k - 1] - 1], k] > 0, Break[]]]; k]];
    Table[Print[n, " ", a[n]]; a[n], {n, 2, 100}] (* Jean-François Alcover, Nov 13 2020, after Alois P. Heinz *)

Extensions

More terms from Alois P. Heinz, Aug 03 2009

A072821 Largest prime that can appear in any representation of n as an arithmetic mean of distinct primes.

Original entry on oeis.org

1, 1, 7, 7, 13, 13, 23, 19, 29, 29, 43, 37, 53, 47, 71, 61, 79, 73, 103, 89, 113, 109, 139, 127, 157, 139, 179, 163, 199, 181, 223, 199, 241, 227, 271, 241, 293, 271, 317, 293, 349, 317, 379, 349, 409, 379, 439, 409, 463, 439, 503, 463, 523, 499, 571, 523, 601
Offset: 2

Views

Author

Reinhard Zumkeller, Jul 15 2002

Keywords

Comments

Thanks to John W. Layman for inspiration.

Examples

			a(6) = 13, as 13 is the largest prime in 6 = (5+7)/2 = (2+3+13)/3 = (2+5+11)/3 = (2+3+5+7+13)/5.
		

Crossrefs

Cf. A072701.

Programs

  • Maple
    sp:= proc(i) option remember; `if` (i=1, 2, sp(i-1) +ithprime(i)) end:
    b:= proc(n, i, t) option remember; local h; if n<0 then 0 elif n=0 then `if` (t=0, 1, 0) elif i=2 then `if` (n=2 and t=1, 2, 0) else `if` (b(n-i, prevprime(i), t-1)>0, i, b(n, prevprime(i), t)) fi end:
    a:= proc(n) local s, k; s:= 1; for k from 2 while sp(k)/k<=n do s:= max (s, b(k*n, nextprime (k*n -sp(k-1)-1), k)) od: s end:
    seq(a(n), n=2..40); # Alois P. Heinz, Aug 03 2009
  • Mathematica
    sp[i_] := sp[i] = If[i == 1, 2, sp[i - 1] + Prime[i]];
    b[n_, i_, t_] := b[n, i, t] = Which[n < 0, 0, n == 0, If[t == 0, 1, 0], i == 2,  If[n == 2 && t == 1, 1, 0], True, If[b[n - i, NextPrime[i, -1], t - 1] > 0, i, b[n, NextPrime[i, -1], t]]];
    a[n_] := Module[{s, k}, s = 1; For[k = 2, sp[k]/k <= n, k++, s = Max[s, b[k*n, NextPrime[k*n - sp[k - 1] - 1], k]]]; s];
    Table[a[n], {n, 2, 60}] (* Jean-François Alcover, Feb 13 2018, after Alois P. Heinz *)

Extensions

More terms from Alois P. Heinz, Aug 03 2009

A082552 Number of sets of distinct primes, the greatest of which is prime(n), whose arithmetic mean is an integer.

Original entry on oeis.org

1, 1, 2, 5, 6, 12, 21, 31, 58, 111, 184, 356, 665, 1223, 2260, 4227, 7930, 15095, 28334, 53822, 102317, 195012, 373001, 714405, 1370698, 2633383, 5067643, 9765457, 18846711, 36413982, 70431270, 136391723, 264384100, 512959093, 996173830
Offset: 1

Views

Author

Naohiro Nomoto, May 03 2003

Keywords

Comments

The sum of the first 23 primes gives 874 = 23*38, see A045345. - Alois P. Heinz, Aug 02 2009

Examples

			a(4) = 5: prime(4) = 7 and the five sets are (5+7)/2 = 6, 7/1 = 7, (3+7)/2 = 5, (2+3+7)/3 = 4, (3+5+7)/3 = 5.
		

Crossrefs

Programs

  • Maple
    b:= proc(t,i,m,h) option remember; if h=0 then `if` (t=0, 1, 0) elif i<1 or h>i then 0 else b (t, i-1, m, h) +b((t+ithprime(i)) mod m, i-1, m, h-1) fi end: a:= n-> add(b(ithprime(n) mod m, n-1, m, m-1), m=1..n): seq (a(n), n=1..40);  # Alois P. Heinz, Aug 02 2009
  • Mathematica
    f[n_] := Block[{c = 0, k = n, lst = Prime@ Range@n, np = Prime@n, slst}, While[k < 2^n, slst = Subsets[lst, All, {k}]; If[Last@slst == np && Mod[Plus @@ slst, Length@slst] == 0, c++ ]; k++ ]; c]; Do[ Print[{n, f@n} // Timing], {n, 24}] (* Robert G. Wilson v *)

Extensions

a(22)-a(24) from Robert G. Wilson v, Jan 19 2007
Corrected a(23) and extended by Alois P. Heinz, Aug 02 2009

A103622 Smallest arithmetic mean of n distinct primes.

Original entry on oeis.org

2, 4, 4, 7, 6, 11, 10, 13, 12, 17, 16, 21, 20, 24, 24, 29, 26, 32, 32, 36, 36, 41, 38, 45, 44, 49, 48, 53, 52, 58, 58, 63, 62, 68, 66, 72, 70, 77, 76, 83, 80, 87, 86, 92, 90, 97, 96, 102, 100, 108, 106, 113, 110, 118, 116, 123, 122, 129, 126, 133, 132, 139, 138, 145, 142
Offset: 1

Views

Author

Giovanni Teofilatto, Mar 25 2005

Keywords

Comments

Often a(2n+1) = a(2n) - 1. - Robert G. Wilson v, Jan 19 2007

Examples

			a(1)=2 because (2)/1=2,
a(2)=4 because (3+5)/2=4,
a(3)=4 because (2+3+7)/3=4,
a(4)=7 because (3+5+7+13)/4=7,
a(5)=6 because (2+3+5+7+13)/5=6,
a(6)=11 because (3+5+7+11+17+23)/6=11,
a(7)=10 because (2+3+5+7+11+13+29)/7=10,
a(8)=13 because (3+5+7+11+13+17+19+29)/8=13,
a(9)=12 because (2+3+5+7+11+13+17+19+31)/9=12,
a(10)=17 because (3+5+7+11+13+17+19+23+29+43)/10=17, etc.
		

Crossrefs

Cf. A072701.

Programs

  • Mathematica
    f[n_] := Block[{k = 1, lst = Prime@ Range[ If[ OddQ@ n, 1, 2], n + 3]}, While[ Mod[Plus @@ Flatten@Subsets[lst, {n}, {k}], n] != 0, k++ ]; (Plus @@ Flatten@ Subsets[lst, {n}, {k}])/n]; Array[f, 65] (* Robert G. Wilson v, Jan 19 2007 *)

Extensions

Edited, corrected and extended by Robert G. Wilson v, Jan 19 2007
Showing 1-9 of 9 results.