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

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

05AB1E, 15 bytes, user4867444 user4867444

DMžDFD1s/+;}01P

Try it online!

Explanation

D # duplicate input
 M # push the largest value on the stack (the input)
 žDF # 4096 times do:
 D # current value
 + # added to
 1s/ # input divided by current value
 ; # divide sum by 2
 } # end loop
 01 # push 1
 P # product of the stack

05AB1E, 15 bytes, user4867444

DMžDFD1s/+;}01P

Try it online!

Explanation

D # duplicate input
 M # push the largest value on the stack (the input)
 žDF # 4096 times do:
 D # current value
 + # added to
 1s/ # input divided by current value
 ; # divide sum by 2
 } # end loop
 01 # push 1
 P # product of the stack

05AB1E, 15 bytes, user4867444

DMžDFD1s/+;}01P

Try it online!

Explanation

D # duplicate input
 M # push the largest value on the stack (the input)
 žDF # 4096 times do:
 D # current value
 + # added to
 1s/ # input divided by current value
 ; # divide sum by 2
 } # end loop
 01 # push 1
 P # product of the stack
Source Link
Emigna
  • 53.2k
  • 5
  • 44
  • 164

05AB1E, 15 bytes, user4867444

DMžDFD1s/+;}01P

Try it online!

Explanation

D # duplicate input
 M # push the largest value on the stack (the input)
 žDF # 4096 times do:
 D # current value
 + # added to
 1s/ # input divided by current value
 ; # divide sum by 2
 } # end loop
 01 # push 1
 P # product of the stack

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