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