Questions tagged [code-golf]
The code-golf tag has no usage guidance.
9
questions
16
votes
5
answers
2k
views
List all homeomorphically distinct irreducible connected simple acyclic graphs of size 10 ("Good Will Hunting" problem)
In the movie Good Will Hunting the opening math problem is:
Display all homeomorphically distinct irreducible connected simple acyclic graphs (trees) of size $n =10$
Recall that a tree (acyclic ...
24
votes
6
answers
4k
views
Creating the Yin Yang symbol with minimal code
The following code creates the Yin Yang symbol
...
5
votes
3
answers
207
views
Build the following symmetric array
My mind is a bit cloudy and I can't quite pinpoint the pattern here that will allow me to write an elegant piece of code to build the following symmetric matrix of for a given size ...
3
votes
1
answer
179
views
Best way to apply a list of functions to a list of values?
This question is closely related to questions 83720, 17460, and 11298.
How would you write the operator
F = Through[#1[#2]] &
in the prettiest, fastest, or ...
3
votes
1
answer
124
views
Rewrite code with fewer characters [closed]
How could I rewrite the following code such that the output (evaluation result) is the same, but is obtained from code having less than 30 characters in total?
...
16
votes
2
answers
1k
views
How to implement Bresenham’s algorithm as a system of equations?
Bresenham's line drawing algorithm is usually implemented via loops. But in Mathematica we can take advantage of its ability to solve Diophantine equations. From educational viewpoint it is quite ...
8
votes
6
answers
2k
views
Make the code shorter for solving Fizz buzz
Here is Fizz buzz
Write a program that prints the integers from 1 to 100. But for
multiples of 3 print "Fizz" instead of the number and for the
multiples of 5 print "Buzz". For numbers which ...
7
votes
1
answer
550
views
Celebration: How to golf a marriage with a prefix free code
We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.
The challenge is ...
10
votes
3
answers
776
views
Code Golf: Least Common Multiple
"CodeGolf" challenge: write the shortest practical Least Common Multiple function that:
Does not use built in GCD, LCM or any ...