123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #!/usr/bin/ruby
- # a(n) is the index of the smallest square pyramidal number with exactly n prime factors (counted with multiplicity).
- # https://oeis.org/A359193
- # Previously known terms:
- # 1, 2, 3, 4, 7, 15, 24, 31, 63, 80, 175, 255, 511, 1023, 512, 6912, 2047, 6655, 14336, 16384, 32767, 90112, 131071, 180224, 483327, 1114112
- # New terms a(26)-a(34):
- # 1638400, 2097151, 1048575, 16777216, 8388607, 33357824, 16777215, 92274687, 67108864
- #`(
- # PARI/GP program:
- a(n) = for(k=1, oo, my(t=(k*(k+1)*(2*k + 1))\6); if(bigomega(t) == n, return(k))); \\ ~~~~
- )
- func a(n) {
- for k in (1..Inf) {
- if (pyramidal(k, 4).is_almost_prime(n)) {
- return k
- }
- }
- }
- for n in (1..100) {
- say "a(#{n}) = #{a(n)}"
- }
- __END__
- a(1) = 2
- a(2) = 3
- a(3) = 4
- a(4) = 7
- a(5) = 15
- a(6) = 24
- a(7) = 31
- a(8) = 63
- a(9) = 80
- a(10) = 175
- a(11) = 255
- a(12) = 511
- a(13) = 1023
- a(14) = 512
- a(15) = 6912
- a(16) = 2047
- a(17) = 6655
- a(18) = 14336
- a(19) = 16384
- a(20) = 32767
- a(21) = 90112
- a(22) = 131071
- a(23) = 180224
- a(24) = 483327
- a(25) = 1114112
- a(26) = 1638400
- a(27) = 2097151
- a(28) = 1048575
- a(29) = 16777216
- a(30) = 8388607
- a(31) = 33357824
- a(32) = 16777215
- a(33) = 92274687
- a(34) = 67108864
|