prog.sf 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/ruby
  2. # a(n) is the smallest square pyramidal number with exactly n distinct prime factors.
  3. # https://oeis.org/A359229
  4. # Previously known terms:
  5. # 1, 5, 14, 30, 1785, 6930, 149226, 3573570, 139223370, 3708968340, 62366724420, 2279301054030, 1348519628145690, 27928822496705130, 1558931949520935990, 430616881400429491950, 161887663616926971163440
  6. #`(
  7. # PARI/GP program:
  8. a(n) = for(k=1, oo, my(t=(k*(k+1)*(2*k + 1))\6); if(omega(t) == n, return(t))); \\ ~~~~
  9. )
  10. func a(n) {
  11. for k in (1..Inf) {
  12. if (pyramidal(k, 4).is_omega_prime(n)) {
  13. return pyramidal(k, 4)
  14. }
  15. }
  16. }
  17. for n in (1..100) {
  18. say "a(#{n}) = #{a(n)}"
  19. }
  20. __END__
  21. a(1) = 5
  22. a(2) = 14
  23. a(3) = 30
  24. a(4) = 1785
  25. a(5) = 6930
  26. a(6) = 149226
  27. a(7) = 3573570
  28. a(8) = 139223370
  29. a(9) = 3708968340
  30. a(10) = 62366724420
  31. a(11) = 2279301054030
  32. a(12) = 1348519628145690
  33. a(13) = 27928822496705130
  34. a(14) = 1558931949520935990
  35. a(15) = 430616881400429491950