### ----------------------------------------------------
### -- Prime::Factor
### -- Licenses: Artistic-2.0
### -- Authors: Steve Schulze (thundergnat)
### -- File: t/01-divisors.rakutest
### ----------------------------------------------------
### -- Chunk 2 of 2
278704, 5841507, 6158488, 6676008, 7788676, 8901344, 9237732, 9457678, 10557408, 11683014, 12316976, 13352016, 14186517, 15577352, 18475464, 18915356, 23366028, 24633952, 26704032, 28373034, 31154704, 33101873, 36950928, 37830712, 46732056, 56746068, 62309408, 66203746, 73901856, 75661424, 93464112, 99305619, 113492136, 132407492, 151322848, 186928224, 198611238, 226984272, 264814984, 397222476, 453968544, 529629968, 794444952, 1059259936, 1588889904, 3177779808), 'auto-sort BIG divisors 3177779808 ok');
is-deeply(divisors(3177779809, :s), (1, 431, 7373039, 3177779809), 'auto-sort BIG divisors 3177779809 ok');
is-deeply(divisors(3177779810, :s), (1, 2, 5, 10, 227, 454, 773, 1135, 1546, 1811, 2270, 3622, 3865, 7730, 9055, 18110, 175471, 350942, 411097, 822194, 877355, 1399903, 1754710, 2055485, 2799806, 4110970, 6999515, 13999030, 317777981, 635555962, 1588889905, 3177779810), 'auto-sort BIG divisors 3177779810 ok');
is-deeply(divisors(3177779811, :s), (1, 3, 19, 57, 61, 183, 1159, 3477, 913943, 2741829, 17364917, 52094751, 55750523, 167251569, 1059259937, 3177779811), 'auto-sort BIG divisors 3177779811 ok');
is-deeply(divisors(3177779812, :s), (1, 2, 4, 739, 1478, 2956, 1075027, 2150054, 4300108, 794444953, 1588889906, 3177779812), 'auto-sort BIG divisors 3177779812 ok');
is-deeply(divisors(3177779813, :s), (1, 13, 244444601, 3177779813), 'auto-sort BIG divisors 3177779813 ok');
is-deeply(divisors(3177779814, :s), (1, 2, 3, 6, 9, 11, 18, 22, 33, 66, 99, 197, 198, 257, 317, 394, 514, 591, 634, 771, 951, 1182, 1542, 1773, 1902, 2167, 2313, 2827, 2853, 3487, 3546, 4334, 4626, 5654, 5706, 6501, 6974, 8481, 10461, 13002, 16962, 19503, 20922, 25443, 31383, 39006, 50629, 50886, 62449, 62766, 81469, 101258, 124898, 151887, 162938, 187347, 244407, 303774, 374694, 455661, 488814, 556919, 562041, 686939, 733221, 896159, 911322, 1113838, 1124082, 1373878, 1466442, 1670757, 1792318, 2060817, 2688477, 3341514, 4121634, 5012271, 5376954, 6182451, 8065431, 10024542, 12364902, 16049393, 16130862, 32098786, 48148179, 96296358, 144444537, 176543323, 288889074, 353086646, 529629969, 1059259938, 1588889907, 3177779814), 'auto-sort BIG divisors 3177779814 ok');
is-deeply(divisors(3177779815, :s), (1, 5, 7, 35, 1483, 7415, 10381, 51905, 61223, 306115, 428561, 2142805, 90793709, 453968545, 635555963, 3177779815), 'auto-sort BIG divisors 3177779815 ok');
is-deeply(divisors(3177779816, :s), (1, 2, 4, 8, 397222477, 794444954, 1588889908, 3177779816), 'auto-sort BIG divisors 3177779816 ok');
is-deeply(divisors(3177779817, :s), (1, 3, 37, 111, 28628647, 85885941, 1059259939, 3177779817), 'auto-sort BIG divisors 3177779817 ok');
is-deeply(divisors(3177779818, :s), (1, 2, 1588889909, 3177779818), 'auto-sort BIG divisors 3177779818 ok');
is-deeply(divisors(3177779819, :s), (1, 79, 263, 20777, 152947, 12082813, 40225061, 3177779819), 'auto-sort BIG divisors 3177779819 ok');
is-deeply(divisors(3177779820, :s), (1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 23, 30, 46, 60, 69, 92, 115, 138, 230, 233, 276, 345, 460, 466, 690, 699, 932, 1165, 1380, 1398, 2330, 2796, 3495, 4660, 5359, 6990, 9883, 10718, 13980, 16077, 19766, 21436, 26795, 29649, 32154, 39532, 49415, 53590, 59298, 64308, 80385, 98830, 107180, 118596, 148245, 160770, 197660, 227309, 296490, 321540, 454618, 592980, 681927, 909236, 1136545, 1363854, 2273090, 2302739, 2727708, 3409635, 4546180, 4605478, 6819270, 6908217, 9210956, 11513695, 13638540, 13816434, 23027390, 27632868, 34541085, 46054780, 52962997, 69082170, 105925994, 138164340, 158888991, 211851988, 264814985, 317777982, 529629970, 635555964, 794444955, 1059259940, 1588889910, 3177779820), 'auto-sort BIG divisors 3177779820 ok');
is-deeply(divisors(3177779821, :s), (1, 10333, 307537, 3177779821), 'auto-sort BIG divisors 3177779821 ok');

is-deeply(divisors(0), (), 'divisors(0) returns an empty list');
is-deeply(divisors(-8), (), 'divisors of a negative Integer returns an empty list');

is-deeply(divisors('12'), (1, 2, 3, 6, 4, 12), 'divisors of an integer string dispatches ok');

fails-like { divisors('12.5') }, X::AdHoc,
    :message(/'divisors() not defined for Rat parameters. Coerce to Int before calling.'/),
    'non-Integer string fails';

fails-like { divisors('zero') }, X::AdHoc,
    :message(/'divisors() not defined for non Integer strings.'/),
    'non-numeric string fails';

done-testing;


