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.

A339665 Number of nonempty subsets of divisors of n whose harmonic mean is an integer.

Original entry on oeis.org

1, 2, 2, 3, 2, 9, 2, 4, 3, 4, 2, 17, 2, 4, 6, 5, 2, 19, 2, 10, 4, 4, 2, 37, 3, 4, 4, 12, 2, 45, 2, 6, 4, 4, 4, 57, 2, 4, 4, 28, 2, 29, 2, 6, 16, 4, 2, 85, 3, 6, 4, 6, 2, 35, 4, 23, 4, 4, 2, 301, 2, 4, 6, 7, 4, 28, 2, 6, 4, 19, 2, 255, 2, 4, 10, 6, 4, 20, 2, 61
Offset: 1

Views

Author

Ilya Gutkovskiy, Dec 11 2020

Keywords

Examples

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

Crossrefs

Programs

  • Mathematica
    a[n_] := Count[Subsets[Divisors[n]], ?(Length[#] > 0 && IntegerQ[HarmonicMean[#]] &)]; Array[a, 100] (* _Amiram Eldar, Nov 09 2021 *)
  • PARI
    h(s, d) = #s/sum(k=1, #s, 1/d[s[k]]);
    a(n) = my(d=divisors(n), nb=0); forsubset(#d, s, if (#s && (denominator(h(s, d))==1), nb++)); nb; \\ Michel Marcus, Dec 15 2020
    
  • Python
    from itertools import combinations
    from sympy import divisors
    def A339665(n):
        ds = tuple(divisors(n, generator=True))
        return sum(sum(1 for d in combinations(ds,i) if n*i % sum(d) == 0) for i in range(1,len(ds)+1)) # Chai Wah Wu, Nov 09 2021