prog.sf 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/usr/bin/ruby
  2. # Numbers k such that the sum of divisors of k (A000203) and the sum of proper divisors of k (A001065) are both triangular numbers (A000217).
  3. # https://oeis.org/A329704
  4. # Are 1 and 36 the only terms that are also triangular numbers?
  5. # Assuming that such a term is also a perfect square, based on the data from A001110, if such a term exists, it must be greater than 10^353.
  6. for k in (2..1e6) {
  7. var t = polygonal(k, 3)
  8. var a = t.inverse_sigma
  9. for n in (a) {
  10. if (n.sigma - n -> is_polygonal(3)) {
  11. say n
  12. }
  13. }
  14. }
  15. __END__
  16. #
  17. ## Some terms of A329704, computed using the inverse sigma function applied on triangular numbers.
  18. #
  19. 1
  20. 2
  21. 5
  22. 36
  23. 54
  24. 473
  25. 441
  26. 6525
  27. 52577
  28. 124025
  29. 683820
  30. 1513754
  31. 1920552
  32. 6762923
  33. 6079931
  34. 14751657
  35. 17052782
  36. 17310942
  37. 49919939
  38. 36543714
  39. 60260967
  40. 372476909
  41. 562047389
  42. 251849052
  43. 364535720
  44. 783856979
  45. 1122603809
  46. 1084201689
  47. 670395564
  48. 670440852
  49. 2239241729
  50. 2284360733
  51. 824626800
  52. 2182908837
  53. 2487938201
  54. 2393957985
  55. 2306100332
  56. 4003025895
  57. 8210186009
  58. 11883589967
  59. 4678227684
  60. 5194927122
  61. 14538854609
  62. 26926218617
  63. 22614789545
  64. 12865159880
  65. 13167458360
  66. 24861819447
  67. 16688185878
  68. 36133539845
  69. 17807934000
  70. 39146468355
  71. 88597109453
  72. 42801425748
  73. 110315059217
  74. 70906440284
  75. 150437851247
  76. 70588308980
  77. 141827039637
  78. 220389070049
  79. 308251916039
  80. 210090511935