Can you solve this?

Saw this on another board I visit and thought I'd post it up on here.

Solve the following:
XXXX/X = XXXX

You can use the numbers from 1-9 but only use each number once

#!/bin/ksh

checkstring () {
echo $string | grep "1" > /dev/null;testone=$?
echo $string | grep "2" > /dev/null;testtwo=$?
echo $string | grep "3" > /dev/null;testthree=$?
echo $string | grep "4" > /dev/null;testfour=$?
echo $string | grep "5" > /dev/null;testfive=$?
echo $string | grep "6" > /dev/null;testsix=$?
echo $string | grep "7" > /dev/null;testseven=$?
echo $string | grep "8" > /dev/null;testeight=$?
echo $string | grep "9" > /dev/null;testnine=$?
if [ $testone == 0 ] && [ $testtwo == 0 ] && [ $testthree == 0 ] && [ $testfour == 0 ] && [ $testfive == 0 ] && [ $testsix == 0 ] && [ $testseven == 0 ] && [ $testeight == 0 ] && [ $testnine == 0 ]
then
result="YES"
else
result="NO"
fi
}

number="1234"

while [ $number -lt 10000 ]
do
# Multiply that number by everything from 1 to 9 and see if it plus the result are all unique numbers.
echo $number
for multiplier in 1 2 3 4 5 6 7 8 9
do
total=`expr $number \* $multiplier`
string="$number $multiplier $total"
checkstring

if [ "$result" == "YES" ]
then
echo "$total / $multiplier = $number YES!!!!!"
fi
done
number=`expr $number + 1`
done


I'll post the other possible answers up later if you don't get it x)
Comments
62
2 confusing cba.
6952 / 4 = 1738
You and danL are correct :]
Those are the only 2 solutions I'm aware of atm
Parent
7852/4=1963
no i cant
nope lol
6789/5 =1234
you have to use all numbers !
Parent
But 6789/5 != 1234 :[
Parent
i know

check other comment:>
Parent
Check reply :~)
Parent
i prefer sudoku!
I used to be addicted to that :P
Don't play it as often now thou, used to have all variations of the game {:
Parent
math rats
omg ksh :(
you cant write xxxx/x=xxxx
then it has to be

1111/1=1111

x=1
You misunderstood the question then :(
2 people got it correct already \o/
Parent
i know what you mean :D

and i know that i am right aswell xDD

and i know that the others write something cool

but there is a mistake in your task :P


if u want that they use every number from 1-9 and write xxxx/x=xxxx
u cant say that the first x = 1 and the next x= 2... all x have to be the same then xD

just wanted to say this ...so i look a bit smart ^^
Parent
Makes you look worse :(
There is no mistake!!
Parent
you are wrong btw :D . when the x are in line it's like x * x * x*x/x=x*x*x*x :D:D
Parent
lol ye xD

just noticed

so panda and me are wrong xD

x/y=z
Parent
:D razzah, quit and go read some, fast!
Parent
don't post solutions panda
It was hidden in case anyone wanted to know :(
It's not like everyone understood it anyway :PP
Parent
i'm not looking at it, i'm trying to make my own solution :P

EDIT: nvm, no time now, will do later, but it's interesting shyt
Parent
What language do you want? Clips? Scheme? C? Java? PHP?
Parent
You offering something? ;x
Parent
... it written in? :)
Parent
Was just given to me, shell script
Parent
did you know that 111111111x111111111=12345678987654321
palindrome powah
Parent
8978/2=4561

i just guessed :((
but you can easily see thats over 9000 :P
Parent
Whats over 9000 ?
Parent
Skydeh

8978/2=4561

i just guessed :((

2*4561 = 9121
Parent
so / is * now?
Parent
You are math pro.
Parent
you should delete that comment :D
Parent
i dont care :DDD
Parent
you mean 9122 right?
Parent
7852/4=1963
8965/2=1337
7852/4=1963
my gueses

6952 / 4 = 1738
7852/4=1963
Wtf is this :D?
too easy, ill let u ppl mess around some more before i tell u the answers
Back to top