For k=2,3,4,5,6 find an example (or prove absence) of a circular prime of k digits (i.e. a prime number that remains prime as its leftmost digit (Most Significant Digit) is moved in turn to the right hand side).
The lowest member of each family of circular primes is listed:
11
13
17
37
79
113
197
199
337
1193
3779
11939
19937
193939
199933
from
10 P=7
20 while P<100000000
30 P=nxtprm(P)
40 Ps1=cutspc(str(P))
43 Good=1
47 for I=1 to len(Ps1)-1
50 Ps2=mid(Ps1,2,*)+left(Ps1,1)
60 P2=val(Ps2):if P2<P then Good=0
65 if prmdiv(P2)<P2 then Good=0:cancel for:goto 90
70 Ps1=Ps2
75 next
80 if Good then print P
90 wend
showing that 7- and 8-digit circular primes do not exist.
A search for 113,197,199,337 in Sloane's OEIS finds sequence A016114, which starts with single digits (k=1). Google search finds that it's conjectured that beyond 199933 are only repunit primes. The primes listed by Sloane are [2, 3, 5, 7, 11, 13, 17, 37, 79, 113, 197, 199, 337, 1193, 3779, 11939, 19937, 193939, 199933, 1111111111111111111, 11111111111111111111111].
Edited on February 6, 2012, 4:52 pm
|
Posted by Charlie
on 2012-02-06 16:50:13 |