Click to See Complete Forum and Search --> : Abt crazy integers.......
eshwarvanaparthi
September 14th, 2006, 10:24 PM
To all gurus and users..... Need help in finding an algorithm...
Crazy integers, for ex: 1234=1000-200+30-4=826.. here 1234 is crazy integer and 826 is ordinary or normal integer. even for crazy 986 is also having 826 as normal integer. .....
question is how to convert normal integer to crazy integer.
2) addition and substraction of any two crazy integers.
3) multiplication of two crazy integers..
we dont have any examples to all this questions .... just question and have to find solution.. its a puzzle????? the logic or procedure
Need an algorithm to solve this problem........
kumaresh_ana
September 15th, 2006, 01:37 AM
Crazy integers, for ex: 1234=1000-200+30-4=826.. here 1234 is crazy integer and 826 is ordinary or normal integer. even for crazy 986 is also having 826 as normal integer. ..... According to this definition even 826 can be crazy
826 = 800 - 20 + 6 = 786=...... Is there a rule to define what is a crazy number?
question is how to convert normal integer to crazy integer.
More than one solution is possible for this question
we dont have any examples to all this questions .... just question and have to find solution.. its a puzzle????? the logic or procedure
Need an algorithm to solve this problem........
Is it a homework?
eshwarvanaparthi
September 16th, 2006, 07:58 PM
its not a home work but u can consider it as a puzzle....
Yves M
September 16th, 2006, 09:01 PM
Well, define what a "crazy integer" is, otherwise it's impossible to help you.
eshwarvanaparthi
September 17th, 2006, 12:42 AM
........
Crazy Integers is .. for ex: 13: 10-3 =7, 7: 7..... here both 13 and 7 are crazy integers for which Ordinary Integer is 7.... similarly you can take another example ....
(crazy)34529:30000-4000+500-20+9 = 26489(Ordinary Integer)
..... so crazy numbers when its digits multiplied with its position value and kept alternate + and -... will give Ordinary Integer.... ,......
there is no particular definition for this ... there is only one example of conversion from crazy to ordinary.... from this example have to find an algorithm to get ordinary to crazy, addition of crazy, substraction, multiplication. create some rules for addition sub and mul....
i have been solving this for a while using some integers and looking there patterns... might it be possible if we took some series of integers and look at there ordinary integers and get some technique to convert ordinary to crazy....
all the best... for all of you
wildfrog
September 17th, 2006, 05:29 AM
might it be possible if we took some series of integers and look at there ordinary integers and get some technique to convert ordinary to crazy....Well, your numbers are just a bit too crazy. They look like negadecimals (number with base -10), but they're not exactly the same.
Negadecimals:
1234 --> 1 * (-10)^3 + 2 * (-10)^2 + 3 ^(-10)^1 + 4 * (-10)^0
= -1000 + 200 - 30 + 4
= - 826
Your crazy integers when number has odd digits (same as negadecimals):
123 --> 1 * (-10)^2 + 2 * (-10)^1 + 3 * (-10)^0
= 100 - 20 + 3
= 83
But for even digit crazy numbers you seem to multiple the series with -1:
1234 --> -1 * (1 * (-10)^3 + 2 * (-10)^2 + 3 * (-10)^1 + 4 * (-10)^0)
= -1 * (- 1000 + 200 - 30 -+ 4)
= 1000 - 200 + 30 - 4
= 826
Anyway, with this knowledge we know that for odd digit crazy numbers we can apply the same technique as we're using on negadecimals. And for even digit crazy numbers we have to multiply the decimal number with -1 before we apply the technique. Only problem I see is that all we got is the decimal number, thus we don't know how many digits the resulting crazy number will have...
Well, lets trywith the crazy number 2222, and convert it to decimal:
// from crazy to decimal
2222 --> 2 * 1000 - 2 * 100 + 2 * 10 - 2
= 1818
Then, lets try to convert the decimal number 1818 back to a crazy number (technique 1, negadecimal):
1818 / -10 = -181 [remainder 8, because (-181) * (-10) + 8 = 1818]
-181 / -10 = 19 [remainder 9, because ( 19) * (-10) + 9 = -181]
19 / -10 = -1 [remainder 9, because ( -1) * (-10) + 9 = 19]
-1 / -10 = 1 [remainder 9, because ( 1) * (-10) + 9 = -1]
1 / -10 = 0 [remainder 1, because ( 0) * (-10) + 1 = 1]
The result is the remainders = 89991
The we need to check the result, 89991. We do so by converting it back to a decimal number and compare it with the original value:
89991 --> 80000 - 9000 + 900 - 90 + 1
= 71811
71811 is not the same as our original decimal 1818. So, lets try technique 2 (the same as before but we negate the original decimal number...):
-1818 / -10 = 182 [remainder 2, because ( 182) * (-10) + 2 = -1818]
182 / -10 = -18 [remainder 2, because ( -18) * (-10) + 2 = 182]
-18 / -10 = 2 [remainder 2, because ( 2) * (-10) + 2 = -18]
2 / -10 = 0 [remainder 2, because ( 0) * (-10) + 2 = 2]
The result is the remainders = 2222
My answer is 2222.
And to confirm, we translate it back to decimal:
2222 --> 2000 - 200 + 20 - 2
= 1818
======
- petter
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.