Richard, just an update on further observations of running your code example. Range set to 0,999 whole numbers.
In this range I would expect few duplicates (some, but not many) however as you can see there appears to be groups of duplicates occuring in the code (when it is sorted in order for us to more easily spot them)
Out of 248 numbers generated there were 25 groups of duplicates with some being repeated up to 3 times.


48,54,107,140,192,200,244,321,353,433,460,465,467,482,512,530,696,732,740,749,755,816,883,927,992

(Not duplicates, but weird to have such a straight as well 394-397 in a range of 1000 numbers and only returning 248 numbers in all.)


1
4
6
7
10
12
17
19
23
27
29
39
44
48
48
54
54
59
61
62
69
71
74
85
97
103
106
107
107
109
111
113
118
131
133
137
140
140
144
147
148
153
154
159
161
167
177
179
181
182
187
192
192
192
197
199
200
200
213
215
216
217
230
232
238
240
244
244
250
252
254
263
272
273
279
285
307
309
312
313
321
321
325
327
328
338
339
343
352
353
353
353
355
366
370
385
386
389
389
390
394
395
396
397
400
402
408
422
426
430
433
433
434
438
442
446
450
454
456
460
460
465
465
467
467
467
469
471
473
482
482
485
487
490
492
494
500
508
512
512
521
522
529
530
530
531
533
534
544
546
548
552
585
596
600
601
611
615
621
625
643
647
658
668
669
673
676
679
696
696
698
700
703
722
731
732
732
737
740
740
744
747
749
749
750
751
755
755
777
779
786
789
801
804
808
810
811
813
816
816
818
821
824
828
829
831
833
838
841
843
846
847
849
853
857
870
872
883
883
883
894
896
900
901
916
917
921
927
927
930
931
936
938
942
943
950
956
959
960
962
970
972
975
978
981
992
992
999