A156239 Smallest octagonal number with n distinct prime factors.
8, 21, 280, 1680, 38760, 326040, 10986360, 185040240, 4897368840, 383246454360, 13143876816840, 376306806515640, 27961718389364760, 3250163645572822440, 152582219844376633080, 6202664616058189439160, 1454199694916714984358120
Offset: 1
Keywords
Examples
a(9) = 4897368840 = 2^3*3*5*7*13*17*23*31*37. 4897368840 is the smallest octagonal number with 9 distinct prime factors.
Links
- Eric Weisstein's World of Mathematics, Octagonal Numbers.
Programs
-
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 *)
-
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
Extensions
a(17) from Donovan Johnson, Jul 03 2011
Comments