Skip to main content
Commonmark migration
Source Link

#VDM-SL, 101 bytes

VDM-SL, 101 bytes

f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x) 

Summing in VDM is not built in, so I need to define a function to do this across the sequences, this ends up taking up the majority of bytes

A full program to run might look like this:

functions 
f:nat+>bool
f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x)

#VDM-SL, 101 bytes

f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x) 

Summing in VDM is not built in, so I need to define a function to do this across the sequences, this ends up taking up the majority of bytes

A full program to run might look like this:

functions 
f:nat+>bool
f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x)

VDM-SL, 101 bytes

f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x) 

Summing in VDM is not built in, so I need to define a function to do this across the sequences, this ends up taking up the majority of bytes

A full program to run might look like this:

functions 
f:nat+>bool
f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x)
Source Link
Expired Data
  • 4k
  • 1
  • 11
  • 34

#VDM-SL, 101 bytes

f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x) 

Summing in VDM is not built in, so I need to define a function to do this across the sequences, this ends up taking up the majority of bytes

A full program to run might look like this:

functions 
f:nat+>bool
f(i)==s([x|x in set {1,...,i-1}&i mod x=0])=i;s:seq of nat+>nat
s(x)==if x=[]then 0 else hd x+s(tl x)