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

Commonmark migration
Source Link

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed).

I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombus, so no need to actually generate the rows.

##How?

How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed).

I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombus, so no need to actually generate the rows.

##How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed).

I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombus, so no need to actually generate the rows.

How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.
added 43 characters in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221

Jelly, 10 bytesbytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed). I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombi.

I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombus, so no need to actually generate the rows.

##How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed). I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombi.

##How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed).

I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombus, so no need to actually generate the rows.

##How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.
added 170 characters in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed). I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombi.

##How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed).

##How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.

Jelly, 10 bytes

×ばつ

Try it online!

A full program / monadic link returning the Nth term (1-indexed). I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombi.

##How?

×ばつ ~ Full program. I'll call the input N.
 € ~ For each integer X in the range [1, N].
Ḥ€ ~ Double each integer in the range [1, X].
 ’ ~ Decrement (subtract 1).
 ŒB ~ Bounce (element-wise). Palindromize each.
 F ~ Flatten.
 ị@ ~ Get the element at the index N in our list.
 ×ばつ ~ Multiply by N.
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221
Loading

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