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
Solution for the n3rdz#!/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)
Those are the only 2 solutions I'm aware of atm
check other comment:>
Don't play it as often now thou, used to have all variations of the game {:
then it has to be
1111/1=1111
x=1
2 people got it correct already \o/
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 ^^
There is no mistake!!
just noticed
so panda and me are wrong xD
x/y=z
It's not like everyone understood it anyway :PP
EDIT: nvm, no time now, will do later, but it's interesting shyt
i just guessed :((
8978/2=4561
i just guessed :((
2*4561 = 9121
6952 / 4 = 1738
7852/4=1963