Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
The challenge involves mathematics in some central way. Also consider using more specific tags, listed in the tag wiki info.
6
votes
Find the perfect square!
Gaia, 5 bytes
(this was produced by trying a bunch of languages from https://github.com/ETHproductions/golfing-langs until I found one that had the most useful built-ins for this problem)
dụ⁇)u
Expla …
8
votes
Find the perfect square!
Jelly, 5 bytes
Ḷ²%ċ0
Uses the formula from the OEIS: the number of solutions to $$x^2 \equiv 0 \ (\mathrm{mod} \ n)$$
Explanation:
implicit input
range 0..n-1,
square each
modulo input (I got this p …
3
votes
Find the number of integers in the range from 1 to N that ends with 2
Pyt [sic!], 3 bytes
Finally found the right language. I had a now-deleted answer in Vim, but it returned the empty string for an input of 1 :(
8+₀
Explanation:
8 In fact, I have no idea whethe …
0
votes
Calculate the Mean mean of two numbers
Sledgehammer, 15 bytes
so I just posted the winning answer to my own question
⡈⠀⣐⢕⠠⢵⠂⡒⡓⠄⠬⢔⣲⣔⢯
Take input as a list of two (or more) machine precision integers.
Mathematica has all the built-ins you c …
42
votes
22
answers
5k
views
Calculate the Mean mean of two numbers
disclaimer: the Mean mean is made up by me
Define the arithmetic mean of \$n\$ numbers as
$$M_1(x_1,...,x_n)=\frac{x_1+x_2+...+x_n}{n}$$
Define the geometric mean of \$n\$ numbers as
$$M_0(x_1,...,x_n …
10
votes
3
answers
555
views
How wavy is an array?
A wave of power \$k\$ is an infinite array that looks like \$1,2,\dots,k,k-1,\dots,1,\dots,k,\dots,1,\dots\$, and so on.
For example, a wave of power 3 starts with \$1,2,3,2,1,2,3,2,1,...\$, and repea …
2
votes
The ultimate inequality challenge
Sledgehammer, 17 bytes
16.75, to be overly specific
⣕⢌⢲⢼⠴⢺⢟⢼⣑⣮⣊⠞⠀⢄⡕⡝⢥
There's no point in trying to read that, so here's the corresponding Mathematica code with a reasonable explanation:
ToExpression …
4
votes
Reverse factorial function
Wolfram Language (Mathematica), 20 bytes
Mathematica has the inverse function of the factorial! It's called InverseFunction@Factorial. I used a pure (Mathematica for "anonymous") function that return …
6
votes
Narcissistic loop lengths
Jelly, 12 bytes
I wonder if this is the same as caird's answer (it probably isn't, because the control flow here almost certainly can be simplified by anyone who actually knows Jelly, or perhaps even …
2
votes
Exponent of complex numbers
C# (.NET Core), 62 38 bytes
a=>c=>System.Numerics.Complex.Pow(a,c)
Try it online!
3
votes
N-Dimensional Cartesian Product
Retina, 54 39 32 bytes
This took really long to write (as I tried to golf it too) (unsurprisingly, all the golfing ideas only appeared after I finally posted this). Takes input as a list of strings o …
11
votes
Where to point a low-orbit ion cannon (asking for a friend)
Wolfram Language (Mathematica), 11 bytes
Mathematica has a built-in for pointing ion cannons. In fact, as far as I know, it should support self-intersecting roofs. Takes input as a polygon.
RandomPo …
11
votes
Integers in cosine
Wolfram Language (Mathematica), 25 bytes
This uses a trick: Mathematica doesn't expand Sin[51819] into a proper number even when Max is called on a list of such things, and because of how Last works, …
1
vote
Distance between two points on the Moon
Wolfram Language (Mathematica), 66 bytes
Clearly the other Wolfram Language golfers only care about bytes. This program uses the beauty of Mathematica.
GeoDistance@@Map[#~GeoPosition~Entity["Planeta …
13
votes
Archimedes's cattle problem
Sledgehammer, 67 66 26 bytes
-40 bytes thanks to @GregMartin and I also no longer have any idea about how my answer works
Completes in less than a few seconds!
⡇⣄⠀⠇⣺⠇⢞⡞⣵⣍⠪⢺⡇⠜⢂⡒⢃⠦⠲⣎⠇⠣⡔⢻⡦⠔
Mathematica …