June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,19 +1,16 @@
|
|||
ispernicious(n::Int) = isprime(count_ones(n))
|
||||
using Primes
|
||||
|
||||
pcnt = 0
|
||||
i = 0
|
||||
print(" ")
|
||||
while pcnt < 25
|
||||
i += 1
|
||||
ispernicious(i) || continue
|
||||
pcnt += 1
|
||||
print(i, " ")
|
||||
ispernicious(n::Integer) = isprime(count_ones(n))
|
||||
nextpernicious(n::Integer) = begin n += 1; while !ispernicious(n) n += 1 end; return n end
|
||||
function perniciouses(n::Int)
|
||||
rst = Vector{Int}(n)
|
||||
rst[1] = 3
|
||||
for i in 2:n
|
||||
rst[i] = nextpernicious(rst[i-1])
|
||||
end
|
||||
return rst
|
||||
end
|
||||
println()
|
||||
perniciouses(a::Integer, b::Integer) = filter(ispernicious, a:b)
|
||||
|
||||
print(" ")
|
||||
for i in 888888877:888888888
|
||||
ispernicious(i) || continue
|
||||
print(i, " ")
|
||||
end
|
||||
println()
|
||||
println("First 25 pernicious numbers: ", join(perniciouses(25), ", "))
|
||||
println("Perniciouses in [888888877, 888888888]: ", join(perniciouses(888888877, 888888888), ", "))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue