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.

A156239 Smallest octagonal number with n distinct prime factors.

This page as a plain text file.
%I A156239 #23 Feb 16 2025 08:33:09
%S A156239 8,21,280,1680,38760,326040,10986360,185040240,4897368840,
%T A156239 383246454360,13143876816840,376306806515640,27961718389364760,
%U A156239 3250163645572822440,152582219844376633080,6202664616058189439160,1454199694916714984358120
%N A156239 Smallest octagonal number with n distinct prime factors.
%C A156239 a(18) <= 68286531655807008335271480. - _Donovan Johnson_, Feb 15 2012
%H A156239 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/OctagonalNumber.html">Octagonal Numbers</a>.
%e A156239 a(9) = 4897368840 = 2^3*3*5*7*13*17*23*31*37. 4897368840 is the smallest octagonal number with 9 distinct prime factors.
%t A156239 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 *)
%o A156239 (Python)
%o A156239 from sympy import primefactors
%o A156239 def octagonal(n): return n*(3*n - 2)
%o A156239 def a(n):
%o A156239     k = 1
%o A156239     while len(primefactors(octagonal(k))) != n: k += 1
%o A156239     return octagonal(k)
%o A156239 print([a(n) for n in range(1, 10)]) # _Michael S. Branicky_, Aug 21 2021
%o A156239 (Python) # faster version using octagonal structure
%o A156239 from sympy import primefactors, primorial
%o A156239 def A000567(n): return n*(3*n-2)
%o A156239 def A000567_distinct_factors(n):
%o A156239     return len(set(primefactors(n)) | set(primefactors(3*n-2)))
%o A156239 def a(n):
%o A156239     k, lb = 1, primorial(n)
%o A156239     while A000567(k) < lb: k += 1
%o A156239     while A000567_distinct_factors(k) != n: k += 1
%o A156239     return A000567(k)
%o A156239 print([a(n) for n in range(1, 10)]) # _Michael S. Branicky_, Aug 21 2021
%Y A156239 Cf. A000567, A076551, A156236, A156237, A156238.
%K A156239 nonn
%O A156239 1,1
%A A156239 _Donovan Johnson_, Feb 07 2009
%E A156239 a(17) from _Donovan Johnson_, Jul 03 2011