prog.sf 776 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/ruby
  2. # a(n) is the smallest n-gonal pyramidal number with exactly n distinct prime factors.
  3. # https://oeis.org/A358864
  4. # Known terms:
  5. # 84, 1785, 299880, 1020510, 8897460, 102612510, 33367223274, 249417828660, 9177835927260, 10064864238489060, 5558913993302670, 15633689593760207970, 3792821921183752657200
  6. # PARI/GP program:
  7. /*
  8. a(n) = if(n<3, return()); for(k=1, oo, my(t=(k*(k+1)*((n-2)*k + (5-n)))\6); if(omega(t) == n, return(t))); \\ ~~~~
  9. */
  10. func a(n) {
  11. for k in (1..Inf) {
  12. if (pyramidal(k, n).is_omega_prime(n)) {
  13. return pyramidal(k, n)
  14. }
  15. }
  16. }
  17. for n in (3..100) {
  18. say "a(#{n}) = #{a(n)}"
  19. }
  20. __END__
  21. a(12) = 10064864238489060
  22. a(13) = 5558913993302670
  23. a(14) = 15633689593760207970
  24. a(15) = 3792821921183752657200