I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

Talk:Gapful numbers

From Rosetta Code

missing output[edit]

Both the Perl 6 (Raku) and Python examples are missing 10000003 from their output, which is 13 * 769231. --Chunes (talk) 13:10, 10 November 2019 (UTC)

Umm. Well you aren't wrong. Perhaps if I tested from 1e7 instead of the task required 1e6 and 1e9. I think what you really mean is: The REXX version is not testing the correct mandated range. --Thundergnat (talk) 13:22, 10 November 2019 (UTC)
I didn't even notice that. The REXX output and task requirements don't agree. This is what happens when Gerard doesn't mandate commas in the output! --Chunes (talk) 13:26, 10 November 2019 (UTC)
To spare Gerard's blushes, let's do 'em both (and 7123) :) --PureFox (talk) 18:17, 10 November 2019 (UTC)
Yuppers.   I was thinking about mandating commas in the output,   and that would've saved me the embarrassment of goofing up my own task.   The output was from an earlier draft of the,   er ... draft task,   and I forgot to update the program and output.   The original (draft) task had an additional set of requirements,   but I elected to drop those and save them for another upcoming Rosetta Code task.   In any case, thanks for spotting the errors in my program/output.   I was trying for ranges that did a wee bit of stress testing   (I had toyed with the idea of also mandating a trillion and also using American English names instead of a numeric one followed with a whole bunch of zeros),   but settled for these three simple ranges, albeit that my REXX program didn't use two of them.     (sigh)     -- Gerard Schildberger (talk) 21:46, 10 November 2019 (UTC)

Count without testing[edit]

I'm thinking about an faster method to count gapful numbers in base 10.
For example in the 1000 numbers [1000..1999] are 218 gapful numbers.
The numbers to check divisibilty are 10 to 19
10 strikes every lcm(10,Base) 10 ,11 strikes every lcm(11,base)=110 .. 19 strikes every lcm(19,base)= 190

           
                            LCM            
10  starts 1000 -> 1000 div  10 =100 strikes            100
11  starts 1001 ->  999 div 110 =  9 strikes +1 (1001)   10
12  starts 1032 ->  968 div  60 = 16 strikes +1          17
13  starts 1053 ->  947 div 130 =  7 strikes +1           8
14  starts 1064 ->  936 div  70 = 13 strikes +1          14 
15  starts 1005 ->  995 div  30 = 33 strikes +1          34
16  starts 1056 ->  944 div  80 = 11 strikes +1          12
17  starts 1037 ->  963 div 170 =  5 strikes +1           6
18  starts 1008 ->  992 div  90 = 11 strikes +1          12
19  starts 1159 ->  841 div 190 =  4 strikes +1           5
                                                sum     218  

So i have only to find the first number and add the manyfold of the lcm in the rest.