r/ProgrammingPrompts • u/mrburrito2 • Feb 06 '15
Question: Was there a prompt here earlier that got deleted?
I believe I saw a prompt that said [Java] and had to do with finding different solutions to an equation with 9 variables. Does anyone have the post or the equation?
10
Upvotes
6
u/desrtfx Feb 06 '15
Here you go:
Solve this equation:
using only numbers 1 - 9, and only each number once!
When a solution is found, print the completed equation.
It was deleted (by OP, not by me) because the limitation to Java made it look too much like homework.
Anybody is welcome to solve it in a language of their choice.
3
u/mrburrito2 Feb 09 '15
I solved it using java if anybody is interested.
1
u/Philboyd_Studge Feb 12 '15 edited Feb 12 '15
Here's mine, I found a way to use only integer math, so my test function looks like this:
The permute function I bastardized from one found online.
Using this brute force method, it takes about a minute to calculate and finds 144 solutions!
Here's the whole code: http://pastebin.com/XK8ZFyXk