-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path530.jl
More file actions
47 lines (43 loc) · 811 Bytes
/
Copy path530.jl
File metadata and controls
47 lines (43 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Primes
function getter(N::Int64)
ans::Int64 = 0
for i in 1:N
if i * i > N
break
end
ans += div(N, i)
end
ans *= 2
gamma::Int64 = floor(sqrt(N))
return ans - gamma * gamma
end
function f(N::Int64)
mx::Int64 = floor(sqrt(N)) + 10
phi::Array{Int} = zeros(1, mx + 10)
for i in 1:mx
phi[i] = i
end
for i in 2:mx
if phi[i] < i
continue
end
j = i
while j <= mx
phi[j] -= div(phi[j], i)
j += i
end
end
ans::Int64 = 0
for f::Int64 in 1:N
if f * f > N
break
end
ans += phi[f] * getter(div(N, f * f))
end
return ans
end
function main()
base::Int64 = 10
println(f(base^15))
end
main()