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.

A051293 Number of nonempty subsets of {1,2,3,...,n} whose elements have an integer average.

Original entry on oeis.org

1, 2, 5, 8, 15, 26, 45, 76, 135, 238, 425, 768, 1399, 2570, 4761, 8856, 16567, 31138, 58733, 111164, 211043, 401694, 766417, 1465488, 2807671, 5388782, 10359849, 19946832, 38459623, 74251094, 143524761, 277742488, 538043663, 1043333934, 2025040765, 3933915348
Offset: 1

Views

Author

John W. Layman, Oct 30 1999

Keywords

Comments

a(n) is asymptotic to 2^(n+1)/n. More precisely, I conjecture for any m > 0, a(n) = 2^(n+1)/n * Sum_{k=0..m} A000670(k)/n^k + o(1/n^(m+1)) (A000670 = preferential arrangements of n labeled elements) which can be written a(n) = 2^n/n * 2 + Sum_{k=1..m} A000629(k)/n^k + o(1/n^(m+1)) (A000629 = necklaces of sets of labeled beads). In fact I conjecture that a(n) = 2^(n+1)/n * (1 + 1/n + 3/n^2 + 13/n^3 + 75/n^4 + 541/n^5 + o(1/n^5)). - Benoit Cloitre, Oct 20 2002
A082550(n) = a(n+1) - a(n). - Reinhard Zumkeller, Feb 19 2006

Examples

			a(4) = 8 because each of the 8 subsets {1}, {2}, {3}, {4}, {1,3}, {2,4}, {1,2,3}, {2,3,4} has an integer average.
		

Crossrefs

Row sums of A061865 and A327481.

Programs

  • Maple
    with(numtheory):
    b:= n-> add(2^(n/d)*phi(d), d=select(x-> x::odd, divisors(n)))/n:
    a:= proc(n) option remember; `if`(n<1, 0, b(n)-1+a(n-1)) end:
    seq(a(n), n=1..40);  # Alois P. Heinz, Jul 15 2019
  • Mathematica
    Table[ Sum[a = Select[Divisors[i], OddQ[ # ] & ]; Apply[Plus, 2^(i/a)*EulerPhi[a]]/i, {i, n}] - n, {n, 34}]
    Table[Count[Subsets[Range[n]],?(IntegerQ[Mean[#]]&)],{n,35}] (* _Harvey P. Dale, Apr 14 2018 *)
  • PARI
    a(n)=sum(k=1,n,sumdiv(k,d,d%2*2^(k/d)*eulerphi(d))/k-1)
    
  • Python
    from sympy import totient, divisors
    def A051293(n): return sum((sum(totient(d)<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))-n # Chai Wah Wu, Feb 22 2023

Formula

a(n) = Sum_{i=1..n} (A063776(i) - 1).

Extensions

Extended by Robert G. Wilson v, Oct 16 2002

A309160 Number of nonempty subsets of [n] whose elements have a prime average.

Original entry on oeis.org

0, 1, 4, 6, 11, 15, 22, 40, 72, 118, 199, 355, 604, 920, 1306, 1906, 3281, 6985, 16446, 38034, 82490, 168076, 325935, 604213, 1068941, 1815745, 3038319, 5246725, 9796132, 19966752, 42918987, 92984247, 197027405, 402932711, 792381923, 1499918753, 2746078246
Offset: 1

Views

Author

Ivan N. Ianakiev, Jul 15 2019

Keywords

Examples

			a(3) = 4 because 4 of the subsets of [3], namely {2}, {3}, {1,3}, {1,2,3}, have prime averages.
		

Crossrefs

Programs

  • 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+n)/(c+1), c+1))
        end:
    a:= n-> b(n, 0$2):
    seq(a(n), n=1..40);  # Alois P. Heinz, Jul 15 2019
  • Mathematica
    a[n_]:=Length[Select[Subsets[Range[n]],PrimeQ[Mean[#]]&]]; a/@Range[25]
  • Python
    from sympy import isprime
    from functools import lru_cache
    def cond(s, c): q, r = divmod(s, c); return r == 0 and isprime(q)
    @lru_cache(maxsize=None)
    def b(n, s, c):
        if n == 0: return int (c > 0 and cond(s, c))
        return b(n-1, s, c) + b(n-1, s+n, c+1)
    a = lambda n: b(n, 0, 0)
    print([a(n) for n in range(1, 41)]) # Michael S. Branicky, Sep 25 2022

Formula

a(n) < A051293(n).

Extensions

a(26)-a(37) from Alois P. Heinz, Jul 15 2019
Showing 1-2 of 2 results.