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

J, 11 bytes

1-<:2&*1-*:

Based on the same formula found earlier earlier.

Try it online!

Explanation

1-<:2&*1-*: Input: integer n
 *: Square n
 1- Subtract it from 1
 <: Decrement n
 2&* Multiply the value 1-n^2 by two n-1 times
1- Subtract it from 1 and return

J, 11 bytes

1-<:2&*1-*:

Based on the same formula found earlier.

Try it online!

Explanation

1-<:2&*1-*: Input: integer n
 *: Square n
 1- Subtract it from 1
 <: Decrement n
 2&* Multiply the value 1-n^2 by two n-1 times
1- Subtract it from 1 and return

J, 11 bytes

1-<:2&*1-*:

Based on the same formula found earlier.

Try it online!

Explanation

1-<:2&*1-*: Input: integer n
 *: Square n
 1- Subtract it from 1
 <: Decrement n
 2&* Multiply the value 1-n^2 by two n-1 times
1- Subtract it from 1 and return
Source Link
miles
  • 17.3k
  • 2
  • 31
  • 95

J, 11 bytes

1-<:2&*1-*:

Based on the same formula found earlier.

Try it online!

Explanation

1-<:2&*1-*: Input: integer n
 *: Square n
 1- Subtract it from 1
 <: Decrement n
 2&* Multiply the value 1-n^2 by two n-1 times
1- Subtract it from 1 and return

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