Primes which contain only one odd digit: Difference between revisions

→‎{{header|Go}}: Stretched to primes under 10 billion.
(→‎{{header|Wren}}: Stretched to primes under 1 billion.)
(→‎{{header|Go}}: Stretched to primes under 10 billion.)
Line 377:
const (
LIMIT = 999
LIMIT2 = 9999999999999999
MAX_DIGITS = 3
)
Line 394:
}
}
fmt.Println("\nFound", len(results), "such primes.\n")
 
primes = rcu.Primes(LIMIT2)
count := 0
pow := 10
for _, prime := range primes[1:] {
if allButOneEven(prime) {
count = count + 1+
}
if prime > pow {
fmt.Printf("There are %7s such primes under %s\n", rcu.Commatize(count), rcu.Commatize(pow))
pow *= 10
}
}
csfmt.Printf("There :=are %7s such primes under %s\n", rcu.Commatize(count), rcu.Commatize(pow))
ls := rcu.Commatize(LIMIT2 + 1)
fmt.Println("\nThere are", cs, "primes under", ls, "which contain only one odd digit.")
}</lang>
 
Line 419 ⟶ 422:
Found 45 such primes.
 
There are 2,560 primes under 1,000,000 which contain only3 onesuch oddprimes under digit.10
There are 12 such primes under 100
There are 45 such primes under 1,000
There are 171 such primes under 10,000
There are 619 such primes under 100,000
There are 2,560 such primes under 1,000,000
There are 10,774 such primes under 10,000,000
There are 46,708 such primes under 100,000,000
There are 202,635 such primes under 1,000,000,000
There are 904,603 such primes under 10,000,000,000
</pre>
 
9,482

edits