OFFSET
1,1
COMMENTS
a(18) <= 68286531655807008335271480. - Donovan Johnson, Feb 15 2012
LINKS
Eric Weisstein's World of Mathematics, Octagonal Numbers.
EXAMPLE
a(9) = 4897368840 = 2^3*3*5*7*13*17*23*31*37. 4897368840 is the smallest octagonal number with 9 distinct prime factors.
MATHEMATICA
f[n_] := PrimeNu@ n; nn = 10; k = 1; t = Table[0, {nn}]; While[Times@@t == 0, oct = k(3k-2); a = f@ oct; If[ a <= nn && t[[a]] == 0, t[[a]] = k; Print[{a, oct}]]; k++]; t (* Robert G. Wilson v, Aug 23 2012 *)
PROG
(Python)
from sympy import primefactors
def octagonal(n): return n*(3*n - 2)
def a(n):
k = 1
while len(primefactors(octagonal(k))) != n: k += 1
return octagonal(k)
print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Aug 21 2021
(Python) # faster version using octagonal structure
from sympy import primefactors, primorial
def A000567(n): return n*(3*n-2)
def A000567_distinct_factors(n):
return len(set(primefactors(n)) | set(primefactors(3*n-2)))
def a(n):
k, lb = 1, primorial(n)
while A000567(k) < lb: k += 1
while A000567_distinct_factors(k) != n: k += 1
return A000567(k)
print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Aug 21 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Donovan Johnson, Feb 07 2009
EXTENSIONS
a(17) from Donovan Johnson, Jul 03 2011
STATUS
approved