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-7 of 7 results.

A339453 Number of subsets of {1..n} whose harmonic mean is an integer.

Original entry on oeis.org

1, 2, 3, 4, 5, 12, 13, 14, 15, 18, 19, 26, 27, 30, 53, 54, 55, 100, 101, 180, 203, 210, 211, 378, 379, 382, 383, 1092, 1093, 2020, 2021, 2022, 3933, 3956, 6473, 10226, 10227, 10266, 10561, 20948, 20949
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 05 2020

Keywords

Comments

For terms listed in the Data section: a(p^k) = a(p^k-1) + 1, where p prime (empirical observation). - Ilya Gutkovskiy, Dec 06 2020
From Chai Wah Wu, Dec 14 2020: (Start)
The above empirical observation is true.
Theorem: For prime p, a(p^k) = a(p^k-1)+1.
Proof: Since the singleton set {x} has harmonic mean x, a(n) >= a(n-1)+1.
Let S = {s_1,s_2,..,s_n} be a subset of {1,2,..,p^k} with n>1 elements such that s_n = p^k and let H be the harmonic mean of S. Let M = A003418(p^k) be the least common multiple of {1,2,..,p^k}. Then M = Wp^k where p does not divide W = A002944(p^k).
Let Q_i = M/s_i and Q = sum_i Q_i. This implies that Q_n = W and p divides Q_i for i < n.
H can be written as nM/Q. Since p does not divide W, this implies that p does not divide Q. Suppose H is an integer. Then this implies that Q divides nM/p^k = nW.
Note that s_i < s_n for i < n. This implies that Q_i > W for i < n, i.e. Q > nW, and this contradicts the fact that Q divides nW and thus H is not an integer.
Thus {p^k} is the only subset of {1,2,..,p^k} that includes p^k and have an integral Harmonic mean.
This concludes the proof.
(End)

Examples

			a(6) = 12 subsets: {1}, {2}, {3}, {4}, {5}, {6}, {2, 6}, {3, 6}, {1, 3, 6}, {2, 3, 6}, {3, 4, 6} and {1, 2, 3, 6}.
		

Crossrefs

Programs

  • Python
    from itertools import chain, combinations
    from fractions import Fraction
    def powerset(s): # skip empty set
        return chain.from_iterable(combinations(s, r) for r in range(1,len(s)+1))
    def hm(s):
        ss = sum(Fraction(1, i) for i in s)
        return Fraction(len(s)*ss.denominator, ss.numerator)
    def a(n):
        return sum(hm(s).denominator==1 for s in powerset(range(1,n+1)))
    print([a(n) for n in range(1, 16)]) # Michael S. Branicky, Dec 06 2020
    
  • Python
    from math import lcm
    from itertools import combinations
    def A339453(n):
        m = lcm(*range(2,n+1))
        return sum(1 for i in range(1,n+1) for d in combinations((m//i for i in range(1,n+1)),i) if m*i % sum(d) == 0) # Chai Wah Wu, Dec 02 2021

Formula

a(n) >= a(n-1)+1. For prime p, a(p^k) = a(p^k-1)+1. - Chai Wah Wu, Dec 14 2020
a(n) = A357411(n) + A357412(n). - Max Alekseyev, Feb 26 2025

Extensions

a(23)-a(29) from Michael S. Branicky, Dec 06 2020
a(30)-a(35) from Chai Wah Wu, Dec 08 2020
a(36)-a(39) from Chai Wah Wu, Dec 11 2020
a(40)-a(41) from Chai Wah Wu, Dec 19 2020

A357415 Number of nonempty subsets of {1..n} whose elements have an odd root mean square.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 6, 6, 7, 9, 16, 26, 41, 85, 142, 254, 461, 825, 1454, 2506, 4535, 7987, 14352, 26178, 47861, 87945, 162486, 304864, 565217, 1064529, 1992628, 3742934, 7034489, 13214869, 24924676, 46926388, 88812537, 167903969, 318619708, 604909434, 1150800393
Offset: 1

Views

Author

Ilya Gutkovskiy, Sep 27 2022

Keywords

Examples

			a(10) = 9 subsets: {1}, {3}, {5}, {7}, {9}, {1, 7}, {1, 5, 7}, {2, 3, 6, 8, 9, 10} and {2, 3, 6, 7, 8, 9, 10}.
		

Crossrefs

Formula

a(n) = A339454(n) - A357416(n).

Extensions

a(24)-a(41) from Alois P. Heinz, Sep 27 2022

A357416 Number of nonempty subsets of {1..n} whose elements have an even root mean square.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 3, 4, 8, 11, 13, 26, 46, 81, 169, 284, 482, 857, 1461, 2548, 4370, 7917, 14181, 25648, 47330, 87457, 163291, 302678, 568974, 1064393, 1993805, 3742588, 7030646, 13231519, 24871349, 46994382, 88657700, 167876827, 318263561, 604694212, 1150634498
Offset: 1

Views

Author

Ilya Gutkovskiy, Sep 27 2022

Keywords

Examples

			a(9) = 8 subsets: {2}, {4}, {6}, {8}, {1, 3, 5, 8, 9}, {3, 4, 5, 7, 9}, {1, 3, 5, 6, 8, 9} and {3, 4, 5, 6, 7, 9}.
		

Crossrefs

Formula

a(n) = A339454(n) - A357415(n).

Extensions

a(24)-a(41) from Alois P. Heinz, Sep 27 2022

A339666 Number of nonempty subsets of divisors of n whose root-mean-square is an integer.

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 3, 4, 3, 4, 2, 6, 2, 6, 4, 5, 2, 6, 2, 6, 6, 4, 2, 8, 3, 4, 4, 9, 2, 8, 2, 6, 4, 4, 7, 9, 2, 4, 4, 12, 3, 12, 2, 6, 7, 4, 2, 12, 5, 6, 4, 6, 2, 8, 5, 12, 4, 4, 2, 26, 2, 4, 9, 7, 4, 8, 2, 6, 4, 14, 2, 12, 2, 4, 6, 6, 6, 8, 2, 24, 5, 6, 2, 22
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 11 2020

Keywords

Examples

			a(14) = 6 subsets: {1}, {2}, {7}, {14}, {1, 7} and {2, 14}.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; uses numtheory; local l, b;
          l, b:= sort([divisors(n)[]]),
          proc(i, s, c) option remember;
            `if`(i=0, `if`(c>0 and issqr(s/c), 1, 0),
             b(i-1, s, c)+b(i-1, s+l[i]^2, c+1))
          end; forget(b); b(nops(l), 0$2)
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Sep 30 2022
  • Mathematica
    a[n_] := a[n] = Module[{b, l = Divisors[n]}, b[i_, s_, c_] := b[i, s, c] = If[i == 0, If[c > 0 && IntegerQ @ Sqrt[s/c], 1, 0], b[i-1, s, c]+b[i-1, s+l[[i]]^2, c+1]]; b[Length[l], 0, 0]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Oct 13 2022, after Alois P. Heinz *)

A369391 Number of nonempty subsets of {1..n} whose elements have a square average.

Original entry on oeis.org

1, 1, 1, 2, 4, 10, 20, 26, 31, 35, 41, 63, 143, 399, 1083, 2554, 5078, 8596, 12772, 17222, 21792, 27126, 36538, 62530, 146701, 412191, 1178071, 3156949, 7703823, 16992539, 33946851, 61840501, 103674983, 161604395, 236759149, 330078718, 446073360, 606337592
Offset: 1

Views

Author

Ilya Gutkovskiy, Jan 22 2024

Keywords

Examples

			a(5) = 4 subsets: {1}, {4}, {3, 5} and {3, 4, 5}.
		

Crossrefs

Extensions

a(24)-a(38) from Alois P. Heinz, Jan 22 2024

A339556 Number of subsets of the first n primes whose elements have a prime root-mean-square.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 11, 16, 19, 30, 41, 54, 69, 106, 177, 272, 397, 686, 1299, 2416, 4225, 7196, 11701, 20352, 36305, 70134, 132721, 248722, 473391, 894318, 1674923, 3054022, 5452067, 9626552, 16696543, 29086462, 51830095, 96887612, 192393735, 397875694
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 08 2020

Keywords

Examples

			a(7) = 11 subsets: {2}, {3}, {5}, {7}, {11}, {13}, {17}, {7, 17}, {5, 7, 17}, {7, 13, 17} and {5, 7, 11, 17}.
		

Crossrefs

Extensions

a(10)-a(40) from Alois P. Heinz, Dec 08 2020

A339569 Number of subsets of {1..n} whose cardinality is equal to the root-mean-square of the elements.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 5, 10, 16, 32, 56, 90, 134, 186, 304, 476, 746, 1308, 2522, 4845, 9129, 17260, 32684, 59908, 106181, 191779, 337793, 596689, 1061991, 1907311, 3518903, 6426672, 12093858, 22777645, 42886411, 81002076, 151575988, 285280108, 529313088
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 09 2020

Keywords

Examples

			a(12) = 10 subsets: {1}, {1, 2, 4, 5, 7, 11}, {1, 3, 5, 6, 8, 9}, {3, 4, 5, 6, 7, 9}, {1, 2, 3, 6, 7, 10, 12}, {2, 3, 4, 5, 8, 9, 12}, {2, 3, 6, 7, 8, 9, 10}, {3, 4, 5, 6, 7, 8, 12}, {1, 2, 5, 6, 9, 10, 11, 12} and {1, 4, 6, 7, 8, 9, 11, 12}.
		

Crossrefs

Programs

  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def b(n, sos, c):
      if n == 0:
        if c>0:
          if sos==c*c*c: return 1
        return 0
      return b(n-1, sos, c) + b(n-1, sos+n*n, c+1)
    a = lambda n: b(n, 0, 0)
    print([a(n) for n in range(1, 44)]) # Michael S. Branicky, Dec 10 2020

Extensions

a(24)-a(43) from Michael S. Branicky, Dec 09 2020
Showing 1-7 of 7 results.