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

C# (.NET Core), 7474 72 bytes

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

Try it online!Try it online!

  • 2 bytes shaved thanks to Kevin Cruijssen.

C# (.NET Core), 74 bytes

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

Try it online!

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.
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100

C# (.NET Core), 74 bytes

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

Try it online!