Skip to main content
1 of 2
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)
Expired Data
  • 4k
  • 1
  • 11
  • 34