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

Bounty Awarded with 100 reputation awarded by Adám
deleted 2 characters in body
Source Link
Razetime
  • 27.6k
  • 3
  • 31
  • 77

APL (dzaima/APL), 15 bytes

{4≤⍵⍧∘.+⍨3*⍨⍳⍵}

Try it online!

Same method as all the other answers. Only works till 4104 due to brute forcing.

more than 20 bytes golfed off with dzaima's help at the APL orchard.

The output appears with a ⊂ next to it, which has been patched in the latest version of the interpreter.

Explanation

{4≤⍵⍧∘.+⍨3*⍨⍳⍵} ⍵ → input
 3*⍨⍳⍵ range 1 to n to, cubed
 ∘.+⍨ dot product, addition with itself
 ⍵⍧ number of times ⍵ appears in the sums
 4≤ is 4 less than or equal to that?

APL (dzaima/APL), 15 bytes

{4≤⍵⍧∘.+⍨3*⍨⍳⍵}

Try it online!

Same method as all the other answers. Only works till 4104 due to brute forcing.

more than 20 bytes golfed off with dzaima's help at the APL orchard.

The output appears with a ⊂ next to it, which has been patched in the latest version of the interpreter.

Explanation

{4≤⍵⍧∘.+⍨3*⍨⍳⍵} ⍵ → input
 3*⍨⍳⍵ range 1 to n to cubed
 ∘.+⍨ dot product, addition with itself
 ⍵⍧ number of times ⍵ appears in the sums
 4≤ is 4 less than or equal to that?

APL (dzaima/APL), 15 bytes

{4≤⍵⍧∘.+⍨3*⍨⍳⍵}

Try it online!

Same method as all the other answers. Only works till 4104 due to brute forcing.

more than 20 bytes golfed off with dzaima's help at the APL orchard.

The output appears with a ⊂ next to it, which has been patched in the latest version of the interpreter.

Explanation

{4≤⍵⍧∘.+⍨3*⍨⍳⍵} ⍵ → input
 3*⍨⍳⍵ range 1 to n, cubed
 ∘.+⍨ dot product, addition with itself
 ⍵⍧ number of times ⍵ appears in the sums
 4≤ is 4 less than or equal to that?
added 72 characters in body
Source Link
Razetime
  • 27.6k
  • 3
  • 31
  • 77

APL (dzaima/APL), 15 bytes

{4≤⍵⍧∘.+⍨3*⍨⍳⍵}

Try it online!

Same method as all the other answers. Only works till 4104 due to brute forcing.

more than 20 bytes golfed off with dzaima's help at the APL orchard.

The output appears with a ⊂ next to it, which has been patched in the latest version of the interpreter.

Explanation

{4≤⍵⍧∘.+⍨3*⍨⍳⍵} ⍵ → input
 3*⍨⍳⍵ range 1 to n to cubed
 ∘.+⍨ dot product, addition with itself
 ⍵⍧ number of times ⍵ appears in the sums
 4≤ is 4 less than or equal to that?

APL (dzaima/APL), 15 bytes

{4≤⍵⍧∘.+⍨3*⍨⍳⍵}

Try it online!

Same method as all the other answers. Only works till 4104 due to brute forcing.

The output appears with a ⊂ next to it, which has been patched in the latest version of the interpreter.

Explanation

{4≤⍵⍧∘.+⍨3*⍨⍳⍵} ⍵ → input
 3*⍨⍳⍵ range 1 to n to cubed
 ∘.+⍨ dot product, addition with itself
 ⍵⍧ number of times ⍵ appears in the sums
 4≤ is 4 less than or equal to that?

APL (dzaima/APL), 15 bytes

{4≤⍵⍧∘.+⍨3*⍨⍳⍵}

Try it online!

Same method as all the other answers. Only works till 4104 due to brute forcing.

more than 20 bytes golfed off with dzaima's help at the APL orchard.

The output appears with a ⊂ next to it, which has been patched in the latest version of the interpreter.

Explanation

{4≤⍵⍧∘.+⍨3*⍨⍳⍵} ⍵ → input
 3*⍨⍳⍵ range 1 to n to cubed
 ∘.+⍨ dot product, addition with itself
 ⍵⍧ number of times ⍵ appears in the sums
 4≤ is 4 less than or equal to that?
Source Link
Razetime
  • 27.6k
  • 3
  • 31
  • 77

APL (dzaima/APL), 15 bytes

{4≤⍵⍧∘.+⍨3*⍨⍳⍵}

Try it online!

Same method as all the other answers. Only works till 4104 due to brute forcing.

The output appears with a ⊂ next to it, which has been patched in the latest version of the interpreter.

Explanation

{4≤⍵⍧∘.+⍨3*⍨⍳⍵} ⍵ → input
 3*⍨⍳⍵ range 1 to n to cubed
 ∘.+⍨ dot product, addition with itself
 ⍵⍧ number of times ⍵ appears in the sums
 4≤ is 4 less than or equal to that?

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