Skip to main content
2 of 2
added 14 characters in body
Charlie
  • 12.9k
  • 1
  • 42
  • 100

C# (.NET Core), 74 72 bytes

n=>{int r=0,j;for(;n>1;n--)for(j=n;--j>0;)if(n%j<1){r+=j;j=0;}return r;}

Try it online!

  • 2 bytes shaved thanks to Kevin Cruijssen.
Charlie
  • 12.9k
  • 1
  • 42
  • 100