Skip to main content
added 67 characters in body
Source Link
Crypto
  • 882
  • 4
  • 8

PHP, 7776 bytes

(Edit -1 byte - Thanks user59178 - your solution is even better)

for($c=substr(bcdiv(1,$a=$argv[1],$a),2);for(;$i<$a;)$s+=($a-$i)*$c[$i++];echo$s; 

PHP, 77 bytes

$c=substr(bcdiv(1,$a=$argv[1],$a),2);for(;$i<$a;)$s+=($a-$i)*$c[$i++];echo$s; 

PHP, 76 bytes

(Edit -1 byte - Thanks user59178 - your solution is even better)

for($c=substr(bcdiv(1,$a=$argv[1],$a),2);$i<$a;)$s+=($a-$i)*$c[$i++];echo$s; 
Source Link
Crypto
  • 882
  • 4
  • 8

PHP, 77 bytes

$c=substr(bcdiv(1,$a=$argv[1],$a),2);for(;$i<$a;)$s+=($a-$i)*$c[$i++];echo$s;