Talk:Multi-base primes: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 3: Line 3:
Who's to say, for instance, that "ABCDEF" won't be prime in 36-16=20 bases? My translation, at least, is not checking that. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 12:13, 3 July 2021 (UTC)<br>
Who's to say, for instance, that "ABCDEF" won't be prime in 36-16=20 bases? My translation, at least, is not checking that. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 12:13, 3 July 2021 (UTC)<br>
Nevermind, I changed the Phix entry to do a full sweep, at initially quite some hit to performance, but thankfully finding a "maxdigit" optimisation, and all the answers happen to have only decimal digits 0..9. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 17:17, 3 July 2021 (UTC)
Nevermind, I changed the Phix entry to do a full sweep, at initially quite some hit to performance, but thankfully finding a "maxdigit" optimisation, and all the answers happen to have only decimal digits 0..9. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 17:17, 3 July 2021 (UTC)

If you consider how you get a 6 digit number like "zzzzzz" where z is 35, such a number excludes any 6-digit forms in any bases below 36. So if we want at least 18 bases to be a possibility, the most significant digit of the number can at most 17, so that means a max of not base 36's 6 digit 2176782335, but the base 17 "gggggg" or 24137568. It turns out that we actually need to go down to 8 on our most significant digit to allow the max number of bases. I agree that I would have had to use at least about 24137568 for the loop range in the Julia otherwise. The change would only be to the top range of the for loop. --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 17:47, 3 July 2021 (UTC)

Revision as of 17:47, 3 July 2021

inadequate range checking?

Hindsight is a wonderful thing. After translating the Rust entry, I am a bit concerned it is skipping a few things it should perhaps not. Who's to say, for instance, that "ABCDEF" won't be prime in 36-16=20 bases? My translation, at least, is not checking that. --Pete Lomax (talk) 12:13, 3 July 2021 (UTC)
Nevermind, I changed the Phix entry to do a full sweep, at initially quite some hit to performance, but thankfully finding a "maxdigit" optimisation, and all the answers happen to have only decimal digits 0..9. --Pete Lomax (talk) 17:17, 3 July 2021 (UTC)

If you consider how you get a 6 digit number like "zzzzzz" where z is 35, such a number excludes any 6-digit forms in any bases below 36. So if we want at least 18 bases to be a possibility, the most significant digit of the number can at most 17, so that means a max of not base 36's 6 digit 2176782335, but the base 17 "gggggg" or 24137568. It turns out that we actually need to go down to 8 on our most significant digit to allow the max number of bases. I agree that I would have had to use at least about 24137568 for the loop range in the Julia otherwise. The change would only be to the top range of the for loop. --Wherrera (talk) 17:47, 3 July 2021 (UTC)