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.
%I A072820 #24 Nov 14 2020 07:08:27 %S A072820 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, %T A072820 16,17,17,19,18,19,19,21,20,23,21,23,22,23,23,25,24,25,25,27,26,27,27, %U A072820 29,28,29,28,29,29,31,30,31,31,33,32,33,33,35,33,35,34,37,35,37,36,37,37 %N A072820 Largest number of distinct primes to represent n as arithmetic mean. %H A072820 Alois P. Heinz, <a href="/A072820/b072820.txt">Table of n, a(n) for n = 2..100</a> %H A072820 Reinhard Zumkeller, <a href="/A072701/a072701.txt">Representing integers as arithmetic means of primes</a> %e A072820 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] %p A072820 sp:= proc(i) option remember; `if`(i=1, 2, sp(i-1) +ithprime(i)) end: %p A072820 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: %p A072820 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 %t A072820 sp[i_] := sp[i] = If[i == 1, 2, sp[i - 1] + Prime[i]]; %t A072820 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]]]]; %t A072820 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]]; %t A072820 Table[Print[n, " ", a[n]]; a[n], {n, 2, 100}] (* _Jean-François Alcover_, Nov 13 2020, after _Alois P. Heinz_ *) %Y A072820 Cf. A072701. %K A072820 nonn %O A072820 2,3 %A A072820 _Reinhard Zumkeller_, Jul 15 2002 %E A072820 More terms from _Alois P. Heinz_, Aug 03 2009