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.

A345957 Number of divisors of n with exactly half as many prime factors as n, counting multiplicity.

This page as a plain text file.
%I A345957 #20 Aug 21 2021 13:22:04
%S A345957 1,0,0,1,0,2,0,0,1,2,0,0,0,2,2,1,0,0,0,0,2,2,0,2,1,2,0,0,0,0,0,0,2,2,
%T A345957 2,3,0,2,2,2,0,0,0,0,0,2,0,0,1,0,2,0,0,2,2,2,2,2,0,4,0,2,0,1,2,0,0,0,
%U A345957 2,0,0,0,0,2,0,0,2,0,0,0,1,2,0,4,2,2,2
%N A345957 Number of divisors of n with exactly half as many prime factors as n, counting multiplicity.
%C A345957 These divisors do not necessarily include the central divisors (A207375), and may not themselves be central.
%e A345957 The a(n) divisors for selected n:
%e A345957   n = 1:  6:  36:  60:  210:  840:  900:  1260:  1296:  3600:
%e A345957      --------------------------------------------------------
%e A345957       1   2    4    4     6     8    12     12     16     16
%e A345957           3    6    6    10    12    18     18     24     24
%e A345957                9   10    14    20    20     20     36     36
%e A345957                    15    15    28    30     28     54     40
%e A345957                          21    30    45     30     81     60
%e A345957                          35    42    50     42            90
%e A345957                                70    75     45           100
%e A345957                               105           63           150
%e A345957                                             70           225
%e A345957                                            105
%t A345957 Table[Length[Select[Divisors[n],PrimeOmega[#]==PrimeOmega[n]/2&]],{n,100}]
%o A345957 (PARI) a(n) = my(nb=bigomega(n)); sumdiv(n, d, 2*bigomega(d) == nb); \\ _Michel Marcus_, Aug 16 2021
%o A345957 (Python)
%o A345957 from sympy import divisors, factorint
%o A345957 def a(n):
%o A345957     npf = len(factorint(n, multiple=True))
%o A345957     divs = divisors(n)
%o A345957     return sum(2*len(factorint(d, multiple=True)) == npf for d in divs)
%o A345957 print([a(n) for n in range(1, 88)]) # _Michael S. Branicky_, Aug 17 2021
%o A345957 (Python 3.8+)
%o A345957 from itertools import combinations
%o A345957 from math import prod, comb
%o A345957 from sympy import factorint
%o A345957 def A345957(n):
%o A345957     if n == 1:
%o A345957         return 1
%o A345957     fs = factorint(n)
%o A345957     elist = list(fs.values())
%o A345957     q, r = divmod(sum(elist),2)
%o A345957     k = len(elist)
%o A345957     if r:
%o A345957         return 0
%o A345957     c = 0
%o A345957     for i in range(k+1):
%o A345957         m = (-1)**i
%o A345957         for d in combinations(range(k),i):
%o A345957             t = k+q-sum(elist[j] for j in d)-i-1
%o A345957             if t >= 0:
%o A345957                 c += m*comb(t,k-1)
%o A345957     return c # _Chai Wah Wu_, Aug 20 2021
%o A345957 (Python)
%o A345957 from sympy import factorint
%o A345957 from sympy.utilities.iterables import multiset_combinations
%o A345957 def A345957(n):
%o A345957     if n == 1:
%o A345957         return 1
%o A345957     fs = factorint(n,multiple=True)
%o A345957     q, r = divmod(len(fs),2)
%o A345957     return 0 if r else len(list(multiset_combinations(fs,q))) # _Chai Wah Wu_, Aug 20 2021
%Y A345957 The case of powers of 2 is A000035.
%Y A345957 Positions of even terms are A000037.
%Y A345957 Positions of odd terms are A000290.
%Y A345957 Positions of 0's are A026424.
%Y A345957 Positions of 1's are A056798.
%Y A345957 The rounded version is A096825.
%Y A345957 The case of all divisors (not just 2) is A347042.
%Y A345957 The smallest of these divisors is A347045 (rounded: A347043).
%Y A345957 The greatest of these divisors is A347046 (rounded: A347044).
%Y A345957 A000005 counts divisors.
%Y A345957 A001221 counts distinct prime factors.
%Y A345957 A001222 counts all prime factors.
%Y A345957 A056239 adds up prime indices, row sums of A112798.
%Y A345957 A207375 lists central divisors.
%Y A345957 A325534 counts separable partitions, ranked by A335433.
%Y A345957 A325535 counts inseparable partitions, ranked by A335448.
%Y A345957 A334997 counts chains of divisors of n by length.
%Y A345957 Cf. A001227, A001414, A028260, A033676, A033677, A073093, A074206, A217581, A344653, A346697-A346704.
%K A345957 nonn
%O A345957 1,6
%A A345957 _Gus Wiseman_, Aug 16 2021