Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 141 characters in body
Source Link

Bash + GNU utilities, 86(削除) 86 (削除ここまで) 85 bytes

for((k=4;k<1ドル;k++,j=k-2)){ [ $(factor`factor $k $j|wc -w)w` = 4 ]&&x=$x+1/$k+1/$j;};bc -l<<<0$x

Try it online! Try it online!

Constructs a large arithmetic expression and then feeds it to bc -l to evaluate it.

Edit: Mistakenly left in a $(...) pair from an old version with nested command substitution; changed to backticks to save a byte.

Bash + GNU utilities, 86 bytes

for((k=4;k<1ドル;k++,j=k-2)){ [ $(factor $k $j|wc -w) = 4 ]&&x=$x+1/$k+1/$j;};bc -l<<<0$x

Try it online!

Constructs a large arithmetic expression and then feeds it to bc -l to evaluate it.

Bash + GNU utilities, (削除) 86 (削除ここまで) 85 bytes

for((k=4;k<1ドル;k++,j=k-2)){ [ `factor $k $j|wc -w` = 4 ]&&x=$x+1/$k+1/$j;};bc -l<<<0$x

Try it online!

Constructs a large arithmetic expression and then feeds it to bc -l to evaluate it.

Edit: Mistakenly left in a $(...) pair from an old version with nested command substitution; changed to backticks to save a byte.

Source Link

Bash + GNU utilities, 86 bytes

for((k=4;k<1ドル;k++,j=k-2)){ [ $(factor $k $j|wc -w) = 4 ]&&x=$x+1/$k+1/$j;};bc -l<<<0$x

Try it online!

Constructs a large arithmetic expression and then feeds it to bc -l to evaluate it.

AltStyle によって変換されたページ (->オリジナル) /