The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A339485 Number of subsets of the first n primes whose elements have a prime average. 2
 1, 2, 3, 6, 9, 12, 17, 30, 51, 88, 149, 264, 439, 746, 1261, 2234, 4211, 7996, 14899, 28048, 54037, 106442, 208625, 398588, 735365, 1331590, 2421573, 4481896, 8504953, 16497150, 32595915, 64614636, 127968263, 252470776, 495388085, 962475122, 1847742473, 3504948056 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 LINKS Alois P. Heinz, Table of n, a(n) for n = 1..150 Eric W. Weisstein's World of Mathematics, Arithmetic Mean EXAMPLE a(5) = 9 subsets: {2}, {3}, {5}, {7}, {11}, {3, 7}, {3, 11}, {3, 5, 7} and {3, 7, 11}. MAPLE b:= proc(n, s, c) option remember; `if`(n=0,       `if`(c>0 and denom(s)=1 and isprime(s), 1, 0),        b(n-1, s, c)+b(n-1, (s*c+ithprime(n))/(c+1), c+1))     end: a:= n-> b(n, 0\$2): seq(a(n), n=1..40);  # Alois P. Heinz, Dec 08 2020 MATHEMATICA b[n_, s_, c_] := b[n, s, c] = If[n == 0,      If[c > 0 && Denominator[s] == 1 && PrimeQ[s], 1, 0],      b[n-1, s, c] + b[n-1, (s*c + Prime[n])/(c+1), c+1]]; a[n_] := b[n, 0, 0]; Array[a, 40] (* Jean-François Alcover, Jul 09 2021, after Alois P. Heinz *) PROG (Python) from sympy import prime, isprime from itertools import chain, combinations def powerset(s): # skip empty set and singletons     return chain.from_iterable(combinations(s, r) for r in range(2, len(s)+1)) def a(n):     out = n  # count all singletons     for s in powerset([prime(i) for i in range(1, n+1)]):         ss = sum(s)         if ss%len(s) == 0:             if isprime(ss//len(s)): out += 1     return out print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Dec 06 2020 (Python) from itertools import combinations from sympy import prime def A339485(n):     c, primeset2 = n, set(prime(i) for i in range(1, n))     primeset = primeset2 | {prime(n)}     for l in range(2, n+1):         for d in combinations(primeset, l):             a, b = divmod(sum(d), l)             if b == 0 and a in primeset2:                 c += 1     return c # Chai Wah Wu, Dec 07 2020 CROSSREFS Cf. A000040, A051293, A071810, A127542, A309160. Sequence in context: A213172 A008810 A280984 * A176893 A144677 A309677 Adjacent sequences:  A339482 A339483 A339484 * A339486 A339487 A339488 KEYWORD nonn AUTHOR Ilya Gutkovskiy, Dec 06 2020 EXTENSIONS a(10)-a(30) from Michael S. Branicky, Dec 06 2020 a(31)-a(34) from Chai Wah Wu, Dec 07 2020 a(35)-a(36) from Michael S. Branicky, Dec 08 2020 a(37)-a(38) from Chai Wah Wu, Dec 08 2020 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified July 24 14:12 EDT 2021. Contains 346273 sequences. (Running on oeis4.)