Powered by Invision Power Board


Forum Rules Forum Rules (Please read before posting)
  Reply to this topicStart new topicStart Poll

> I Need A Bit Help
dmg
Posted: December 17, 2016 10:26 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 1,228
Member No.: 36,860
Joined: June 06, 2012




okay it does sound stupid, but geesh.. i can't figure this out.

the "problem"

we take a 4 digit number, and add to it it self without its last digit, then again without 2 digits, then without 3 digits, and then we get 2016.
what was the number we where thinking about?
so if my 4 digit number is ABCD,
then
ABCD+ABC+AB+A = 2016

how on earth you make an equtation that can describe this at all ??
PMEmail Poster
Top
PIC
Posted: December 17, 2016 11:54 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Cleanup Taskforce
Posts: 1,093
Member No.: 6,662
Joined: October 08, 2006




Hi,

Say the digits are A, B, C, D. That means each letter stands for a number that is between 0-9.

ABDC (e.g 1234) is made by A*1000 + B*100 + C*10 + D

ABCD doesn't mean A x B x C x D, as the letters are simply each digits 0-9 which you shift into the right position using x10, x100, etc.

When we do that adding operation you described:
2016 =
A*1000 + B*100 + C*10 + D
+ A*100 + B*10 + C
+10*A + B
+ A

The first line is a summation which converts the single digits A, B, C, D (each of which is 0-9) into the number ABDC, and same idea for ABC, etc.

Collecting terms:
1111*A + 111*B + 11*C + D = 2016

You have 4 unknown digits and only one equation, whereas you need the same number of equations as unknowns in order to solve.

However, from the way the question was set up, you do know that each variable must be whole number that is from 0-9. The only way I know how to go about this is by brute force - to try every possible combination of A, B, C, D and see if you find a solution along the way. Matlab script that does this:
CODE

%sweep over A from 0-9
for A = 0:9
   %for each A, sweep over B from 0-9
   for B = 0:9
       %and so on for C and D
       for C = 0:9
           for D = 0:9
               if (1111*A + 111*B + 11*C + D) == 2016 %does this combo give the right answer?
                   disp([A B C D]) %displays the solution if it finds one
               end
           end
       end
   end
end


Completes in an instant, and of the 10, 000 combinations it iterates through (0000 to 9999), there is one solution: A=1, B=8, C=1, D=6.

So if we say the number ABCD corresponds digit-wise to 1816, then 1816+181+18+1 = 2016 as sought.

QUOTE
how on earth you make an equtation that can describe this at all ??
I can't answer that I just coded it up laugh.gif I shared your confusion up that point it's more involved than it first seems.
PM
Top
gremlinsa
Posted: December 18, 2016 09:09 pm
Reply to this postQuote Post


Forum Addict
******

Group: Trusted Members
Posts: 810
Member No.: 3,112
Joined: August 25, 2005




Given the way the 'equation' is given you need to look at it a little differently...

Firstly: break it down and add a few of your own unknowns..

A+B+C+D = X6 ( or rather X*10 + 6)
A+B+C+X = Y*10 + 1
A+B+Y = Z*10 + 0
A+Z = 2

Now we need to apply a few rules...
0<=A<=9; 0<=B<=9; 0<=C<=9; 0<=D<=9 ...
But also, X>=0, Y>=0, Z>=0

So with A+Z=2 that reduces A and Z to <=2

If B, C & D = 9 then X<=3, and Y<=2.... (Maximum possible Carry's, Our unknowns)
So now we look at A+B+Y .... if A=2, Y=2 and B=9 the max Z could be is 1...
Ahh now .. we have..

0<=A<=2; 0<=B<=9; 0<=C<=9; 0<=D<=9 ...
0<=X<=3; 0<=Y<=2; 0<=Z<=1 ...

So now .. A+B+Y = Z10 (0 or 10) But A+Z = 2 so A>=1

BUT if A=2 then B+Y=8 and Z=1. Thus A=1 and Z=1...

Now we have...
1+B+Y=10 or B+Y =9
1+B+C+X = Y10+1 or B+C+X=Y10 (10,20) : Ahh Y>0 Because 9+1=10 (if B=9 and leave C+X out), So now 1<=Y<=2, 7<=B<=8..

Dig in again, If B=7 then C+X = 17 which means X>=8 C+X = 13 which means X>=4.. no good, thus B=8 and Y=1.. now we have..
1+8+C+X = 10+1 or C+X = 2
1+8+C+D = X10 + 6 or C+D+3 = X10 (10,20) : X cant be 0 or 3 because C or D cant be negative.. So now 1<=X<=2, 0<=C<=1..

Dig in once more, If C=0 then X=2 and D=17, No good... So C=1 and X=1..

Now we get left with

1+8+1+D=10+6 or:
D=6

Solved... Without Brute Force.....

...EDIT...
Fixed a error in calculations..


--------------------
Give me a Break... I'm dik-lic-sic, dus-kik-lic.... Gawd ... F'ed in the Head...
PMEmail PosterUsers Website
Top
dmg
Posted: December 18, 2016 09:36 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 1,228
Member No.: 36,860
Joined: June 06, 2012




uuu thank you a lot smile.gif
i was able to figure out the answer, but i found no way to write it down with math.

thank you for the help smile.gif
PMEmail Poster
Top
Sch3mat1c
Posted: December 19, 2016 12:30 am
Reply to this postQuote Post


Forum Addict ++
Group Icon

Group: Moderators
Posts: 20,470
Member No.: 73
Joined: July 24, 2002




Nice. smile.gif


--------------------
Answering questions is a tricky subject to practice. Not due to the difficulty of formulating or locating answers, but due to the human inability of asking the right questions; a skill that, were one to possess, would put them in the "answering" category.
PMEmail PosterUsers Website
Top
MacFromOK
Posted: December 19, 2016 01:53 am
Reply to this postQuote Post


Forum Addict ++
*******

Group: Spamminator Taskforce
Posts: 15,094
Member No.: 5,314
Joined: June 04, 2006




QUOTE (gremlinsa @ December 18, 2016 02:09 pm)
Solved... Without Brute Force.....

Brute force has gotten me through a lot over the years... biggrin.gif


--------------------
Mac *

"Basic research is what I'm doing when I don't know what I'm doing." [Wernher Von Braun]

* is not responsible for errors, consequential damage, or... anything.
PMEmail Poster
Top
phin
Posted: December 23, 2016 02:41 am
Reply to this postQuote Post


Newbie
**

Group: Members+
Posts: 11
Member No.: 40,315
Joined: December 19, 2016




QUOTE (MacFromOK @ December 18, 2016 07:53 pm)
[/QUOTE]
Brute force has gotten me through a lot over the years... biggrin.gif

While working as an EE manufacturing engineer, I had to come up with a program to determine how much metal to cut from a rotating part to bring it into balance. Now, I was never a math wiz and this was well beyond me. I told my boss the problem and he called in a mathematician to give me an equation. After a week of beating his head against the wall, he told me to brute force the solution. ie try an answer, look at the error resulting and modify the answer until the result was within tolerance. Worked fine and the computer did not seem to mind. Although MANY electrons were mistreated along the way!
PMEmail Poster
Top
gremlinsa
Posted: December 23, 2016 07:20 pm
Reply to this postQuote Post


Forum Addict
******

Group: Trusted Members
Posts: 810
Member No.: 3,112
Joined: August 25, 2005




QUOTE (phin @ December 23, 2016 03:41 am)
After a week of beating his head against the wall, he told me to brute force the solution. ie try an answer, look at the error resulting and modify the answer until the result was within tolerance. Worked fine and the computer did not seem to mind. Although MANY electrons were mistreated along the way!

In a case like that you need a Engineering Mathematician... Knowledge of metal density's, rotational balancing sensor sensitivity, etc.... Bet you this is where he was banging his head!!!


--------------------
Give me a Break... I'm dik-lic-sic, dus-kik-lic.... Gawd ... F'ed in the Head...
PMEmail PosterUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 


:: support us ::




ElectronicsSkin by DutchDork & The-Force