R.T.
  • Member for 7 years, 8 months
  • Last seen more than 4 years ago
3 answers
11 votes
2k views
Evaluate the Riemann Zeta Function at a Complex Number
8 votes

Python - 385 This is a straightforward implementation of Equation 21 from http://mathworld.wolfram.com/RiemannZetaFunction.html This uses Python's convention for optional arguments; if you want to ...

View answer
2 answers
5 votes
3k views
Draw a Golden Spiral!
6 votes

Python 3 - 290 269 This will get crushed by any kind of built-in parametrics, but I figured I'd post it as an example of a point-by-point solution. Edit: Thanks for the golfing tips! If you have any ...

View answer
4 answers
13 votes
541 views
Trilaterate your position
3 votes

Python - 172 Takes input as a list of tuples of form (x,y,d). Let me know if you see a way to golf this further, I feel like there must be but I can't figure it out! import numpy as N def L(P): ...

View answer
2 answers
13 votes
5k views
Frogger-ish game
3 votes

Python 3.3 - Ungolfed I have not golfed this at all, as I was more interested in just getting a good-looking game working first. I am actually totally new to Tk, so if anyone has any suggestions, I ...

View answer
15 answers
14 votes
3k views
Spirograph Time!
3 votes

Python: 579 Summary This is not competitive at all given the Mathematica answer, but I decided to post it anyway because the pictures are pretty and it may inspire someone or be useful to someone. ...

View answer
4 answers
8 votes
746 views
Counting orthogonal circulant matrices
2 votes

Python (404 matrices on i5-5300U) Mainly posting this as a starting point for others to improve on, this can be cleaned up a lot, parallelized, etc. import numpy import itertools import time def ...

View answer
6 answers
17 votes
2k views
Travelling Salesman
2 votes

Python 3 - 491 I did not count the length of the input graph variable g. This solution uses dynamic programming, and has a complexity of n^2 * 2^n, for a total score of ~6.39e147. I am still pretty ...

View answer
3 answers
11 votes
765 views
Sort some apples!
2 votes

Python 3 - 121 This implements a depth-first searching with increasing depth until it finds a solution. It uses a dictionary to store visited states so that it doesn't visit them again unless with a ...

View answer
4 answers
13 votes
3k views
Find the Chromatic Number
2 votes

Python 3 - 162 Uses the same brute-force approach, but uses the itertools library for hopefully faster combination generation. Solves the complete 8-graph in < 1 min on my fairly ordinary machine. ...

View answer
10 answers
16 votes
2k views
Undo the square roots
1 votes

Python 3 - 157 174 169 - 10 = 159 Edit1: Changed the output format to space-separated integers instead of comma-separated. Thanks for the tip of removing the braces around (n,x). Edit2: Thanks for ...

View answer
3 answers
6 votes
875 views
The distance between circles
1 votes

C The first argument is a filename which the program expects to read for input. The first line of the file contains the circumference and the number of points each of circle a and circle b. Then the ...

View answer
3 answers
7 votes
2k views
Knight's tour game (7x7)
1 votes

Python 3 - 272 263 Since this is a code-golf, this is built to be shorter in code, as opposed to faster in execution. Note that if you want solutions that will run in practical amounts of time, that ...

View answer
14 answers
22 votes
3k views
Un-round fractions
1 votes

C, 233 This works by calling a rationalization function r() with a starting denominator of 1. The function begins incrementing a numerator, and checking at every increment whether the resulting ...

View answer
6 answers
7 votes
5k views
Solve quadratic equation using only 3 variables and arithmetic
1 votes

C - 50 48 I use the 32-bit float shortcut for getting a good initial seed for the square root. That allows me to get away with just a few iterations of Newton's method. I haven't found a set of ...

View answer