Skip to main content
added 20 characters in body
Source Link
ophact
  • 3.2k
  • 1
  • 7
  • 24

JavaScript (Node.js), 6761 bytes

N=>eval('for(k=0,n=1;n<=N;n++k=n=0;n++<N;)for(c=e=N%n||n;c<=e+N-n;k+=c*c++n;);k'k+=c*c++')

Try it online!Try it online!

-2 by Polichinelle.

Iteratively calculates sum, which is shorter than direct calculation.

JavaScript (Node.js), 67 bytes

N=>eval('for(k=0,n=1;n<=N;n++)for(c=e=N%n||n;c<=e+N-n;k+=c*c++);k')

Try it online!

Iteratively calculates sum, which is shorter than direct calculation.

JavaScript (Node.js), 61 bytes

N=>eval('for(k=n=0;n++<N;)for(c=e=N%n||n;c<=e+N-n;)k+=c*c++')

Try it online!

-2 by Polichinelle.

Iteratively calculates sum, which is shorter than direct calculation.

deleted 58 characters in body
Source Link
ophact
  • 3.2k
  • 1
  • 7
  • 24

JavaScript (Node.js), 7867 bytes

N=>eval('for(k=n=0;n<N;c=N%++n||n,d=c+N-nk=0,k+=d*-~d*(d-~dn=1;n<=N;n++)-~-c*c*for(c+cc=e=N%n||n;c<=e+N-1)n;k+=c*c++);k/6';k')

Try it online!

-1 by @KevinCruijssenTry it online!

DirectlyIteratively calculates the sum for each n, ratherwhich is shorter than iteratively doing sodirect calculation.

JavaScript (Node.js), 78 bytes

N=>eval('for(k=n=0;n<N;c=N%++n||n,d=c+N-n,k+=d*-~d*(d-~d)-~-c*c*(c+c-1));k/6')

Try it online!

-1 by @KevinCruijssen

Directly calculates the sum for each n, rather than iteratively doing so.

JavaScript (Node.js), 67 bytes

N=>eval('for(k=0,n=1;n<=N;n++)for(c=e=N%n||n;c<=e+N-n;k+=c*c++);k')

Try it online!

Iteratively calculates sum, which is shorter than direct calculation.

added 104 characters in body
Source Link
ophact
  • 3.2k
  • 1
  • 7
  • 24

JavaScript (Node.js), 7978 bytes

N=>eval('for(k=n=0;n<N;c=N%++n||n,d=c+N-n,k+=d*-~d*(d+d+1d-~d)-~-c*c*(c+c-1));k/6')

Try it online!Try it online!

-1 by @KevinCruijssen

Directly calculates the sum for each n, rather than iteratively doing so.

JavaScript (Node.js), 79 bytes

N=>eval('for(k=n=0;n<N;c=N%++n||n,d=c+N-n,k+=d*-~d*(d+d+1)-~-c*c*(c+c-1));k/6')

Try it online!

JavaScript (Node.js), 78 bytes

N=>eval('for(k=n=0;n<N;c=N%++n||n,d=c+N-n,k+=d*-~d*(d-~d)-~-c*c*(c+c-1));k/6')

Try it online!

-1 by @KevinCruijssen

Directly calculates the sum for each n, rather than iteratively doing so.

Source Link
ophact
  • 3.2k
  • 1
  • 7
  • 24
Loading