Create a chain of consecutive digits starting with 1 and following 9 by 0:
123456789012345...How many digits are needed to obtain the 1st prime number?
(In reply to
computer exploration by Charlie)
The idiosyncrasies of UBASIC(that I knew about, but didn't think about):
The UBASIC builtin function prmdiv returns a zero when the smallest prime divisor of the argument passed to it is too large for it to handle. That in fact is why I had added the probabilistic prime test. However, I neglected to change the preface "if p>1" that had been added previously, as UBASIC erroneously reports the largest prime divisor of 1 as being 1, which of course is not prime.
In line 70, I should have had "if v>1" rather than "if p>1" as p was the prmdiv that UBASIC returned and v was the value of the whole number.
With that replacement and removal of the stop after finding one, the first three primes found are:
1234567890123456789012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789012345678901234567890123456789
012345678901
length 171
1234567890123456789012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567
length 277
1234567890123456789012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789012345678901234567890123456789
012345678901234567890123456789012345678901234567
length 367
Edited on April 11, 2015, 8:40 am

Posted by Charlie
on 20150411 08:32:42 