Jump to content

Extreme primes: Difference between revisions

→‎{{header|Go}}: Some changes as a result of changes to Go-rcu package.
(→‎{{header|Go}}: Some changes as a result of changes to Go-rcu package.)
Line 173:
"rcu"
)
 
func commatizeU64(n uint64) string {
s := fmt.Sprintf("%d", n)
if n < 0 {
s = s[1:]
}
le := len(s)
for i := le - 3; i >= 1; i -= 3 {
s = s[0:i] + "," + s[i:]
}
if n >= 0 {
return s
}
return "-" + s
}
 
func nextPrime(n *big.Int) *big.Int {
Line 228 ⟶ 213:
if m < 6 || m == 30 || m == 40 || m == 50 {
scount := rcu.Commatize(count)
ssum := commatizeU64rcu.Commatize(sum.Uint64())
sp := commatizeU64rcu.Commatize(p.Uint64())
fmt.Printf("The %6sth extreme prime is: %18s for p <= %10s\n", scount, ssum, sp)
if m == 50 {
9,485

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.