Abundant odd numbers
sub odd-abundant (\x) {
my @l = x.is-prime ?? 1 !! flat
1, (3 .. x.sqrt.floor).map: -> \d {
next unless d +& 1;
my \y = x div d;
next if y * d !== x;
d !== y ?? (d, y) !! d
};
@l.sum > x ?? @l.sort !! Empty;
}
sub odd-abundants (Int :$start-at is copy) {
$start-at = ( $start-at + 2 ) div 3;
$start-at += $start-at %% 2;
$start-at *= 3;
($start-at, *+6 ... *).hyper.map: {
next unless my $oa = cache .&odd-abundant;
sprintf "%6d: divisor sum: {$oa.join: ' + '} = {$oa.sum}", $_
}
}
put 'First 25 abundant odd numbers:';
.put for odd-abundants( :start-at(1) )[^25];
put "\nOne thousandth abundant odd number:\n" ~ odd-abundants( :start-at(1) )[999] ~
"\n\nFirst abundant odd number above one billion:\n" ~ odd-abundants( :start-at(1_000_000_000) ).head;
Output:
First 25 abundant odd numbers:
945: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
1575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
2205: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
2835: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
3465: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
4095: divisor sum: 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
4725: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
5355: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
5775: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
5985: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
6435: divisor sum: 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
6615: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
6825: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
7245: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
7425: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
7875: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
8085: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
8415: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
8505: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
8925: divisor sum: 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
9135: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
9555: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
9765: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
10395: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
11025: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946
One thousandth abundant odd number:
492975: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361
First abundant odd number above one billion:
1000000575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009
Last updated