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

deleted 105 characters in body
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

Jelly, non-competing9 bytes

9 bytesThis answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ðṛ¡

Try it online!

How it works

SH;P1⁄2\ðṛ¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 ṛ Return the right argument (y).
 ¡ Repeat the pushed chain y times.

Jelly, non-competing

9 bytesThis answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ðṛ¡

Try it online!

How it works

SH;P1⁄2\ðṛ¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 ṛ Return the right argument (y).
 ¡ Repeat the pushed chain y times.

Jelly, 9 bytes

SH;P1⁄2\ðṛ¡

Try it online!

How it works

SH;P1⁄2\ðṛ¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 ṛ Return the right argument (y).
 ¡ Repeat the pushed chain y times.
added 3 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, non-competing

9 bytes This answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ð}¡SH;P1⁄2\ðṛ¡

Try it online! Try it online!

How it works

SH;P1⁄2\ð}¡SH;P1⁄2\ðṛ¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 } Return the right argument (y).
 ¡ Repeat the pushed chain y times.

Jelly, non-competing

9 bytes This answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ð}¡

Try it online!

How it works

SH;P1⁄2\ð}¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 } Return the right argument (y).
 ¡ Repeat the pushed chain y times.

Jelly, non-competing

9 bytes This answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ðṛ¡

Try it online!

How it works

SH;P1⁄2\ðṛ¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
  Return the right argument (y).
 ¡ Repeat the pushed chain y times.
added 7 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, 9 bytesnon-competing

9 bytesThis answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ð}¡

Try it online!

How it works

SH;P1⁄2\ð}¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 } Return the right argument (y).
 ¡ Repeat the pushed chain y times.

Jelly, 9 bytes

This answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ð}¡

Try it online!

How it works

SH;P1⁄2\ð}¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 } Return the right argument (y).
 ¡ Repeat the pushed chain y times.

Jelly, non-competing

9 bytesThis answer is non-competing, since it uses features that postdate the challenge.

SH;P1⁄2\ð}¡

Try it online!

How it works

SH;P1⁄2\ð}¡ Input: x (vector) -- y (repetitions)
SH Take the sum (S) of x and halve (H) the result.
 P1⁄2 Take the product (P) of x and the square root (1⁄2) of the result.
 \ Combine the last two instructions in a dyadic chain.
 ; Concatenate the results to the left and to the right.
 ð Push the preceding, variadic chain; begin a new, dyadic chain.
 } Return the right argument (y).
 ¡ Repeat the pushed chain y times.
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
Loading

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