OFFSET
1,1
COMMENTS
a(18) <= 150849873309136386205130310. - Donovan Johnson, Feb 15 2012
LINKS
Eric Weisstein's World of Mathematics, Heptagonal Numbers.
EXAMPLE
a(9) = 16015883940 = 2^2*3^2*5*7*17*19*23*29*59. 16015883940 is the smallest heptagonal number with 9 distinct prime factors.
PROG
(Python)
from sympy import primefactors
def A000566(n): return n*(5*n-3)//2
def a(n):
k = 1
while len(primefactors(A000566(k))) != n: k += 1
return A000566(k)
print([a(n) for n in range(1, 9)]) # Michael S. Branicky, Jul 18 2021
(Python) # faster version using heptagonal structure
from sympy import primefactors
def A000566(n): return n*(5*n-3)//2
def A000566_distinct_factors(n):
pf1 = primefactors(n)
pf2 = primefactors(5*n-3)
combined = set(pf1) | set(pf2)
return len(combined) if n%4 == 0 or (5*n-3)%4 == 0 else len(combined)-1
def a(n):
k = 1
while A000566_distinct_factors(k) != n: k += 1
return A000566(k)
print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Jul 18 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Donovan Johnson, Feb 07 2009
EXTENSIONS
a(17) from Donovan Johnson, Jul 02 2011
STATUS
approved