-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP719.jl
More file actions
37 lines (32 loc) · 768 Bytes
/
Copy pathP719.jl
File metadata and controls
37 lines (32 loc) · 768 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
using ProgressMeter
function assemble(digs::Vector{<:Int})::Int
return reduce((x, y) -> 10x + y, reverse(digs))
end
function splitttingnumber(n::Int, digs::Vector{<:Int}=[])::Bool
if n<0
return false
elseif n==0
if digs==[]
return true
else
return false
end
else
k=assemble(digs)
if k<n
return false
elseif k == n
return true
else
l=length(digs)
return [splitttingnumber(n-assemble(digs[1:i]), digs[i+1:l]) for i in 1:l]|>any
end
end
end
splitttingnumber(N::Int)::Bool=splitttingnumber(N, digits(N^2))
S=0
@showprogress for i in 2:10^6
if splitttingnumber(i)
global S+=i^2
end
end