Smarandache-Wellin primes: Difference between revisions

→‎{{header|Go}}: Corrected ordinal number display.
(→‎{{header|C}}: Changed in line with Wren solution of which it is a translation.)
(→‎{{header|Go}}: Corrected ordinal number display.)
Line 178:
"strings"
)
 
func ord(count int) string {
if count == 1 {
return "st"
}
if count == 2 {
return "nd"
}
if count == 3 {
return "rd"
}
return "th"
}
 
func main() {
Line 196 ⟶ 209:
sws = sws[0:20] + "..." + sws[le-20:le]
}
fmt.Printf("%dthd%s: index %4d digits %4d last prime %5d -> %s\n", count, ord(count), i+1, len(sw), primes[i], sws)
}
i++
Line 219 ⟶ 232:
if n.ProbablyPrime(15) {
count++
fmt.Printf("%2dth2d%s: index %4d prime %v\n", count, ord(count), i+1, n)
}
i++
Line 228 ⟶ 241:
<pre>
The known Smarandache-Wellin primes are:
1th1st: index 1 digits 1 last prime 2 -> 2
2th2nd: index 2 digits 2 last prime 3 -> 23
3th3rd: index 4 digits 4 last prime 7 -> 2357
4th: index 128 digits 355 last prime 719 -> 23571113171923293137...73677683691701709719
5th: index 174 digits 499 last prime 1033 -> 23571113171923293137...10131019102110311033
Line 238 ⟶ 251:
 
The first 20 Derived Smarandache-Wellin primes are:
1th1st: index 32 prime 4194123321127
2th2nd: index 72 prime 547233879626521
3th3rd: index 73 prime 547233979727521
4th: index 134 prime 13672766322929571043
5th: index 225 prime 3916856106393739943689
9,476

edits