Monday, August 23, 2010

ALGORITHM FOR ADDTION OF TWO NUMBERS

Type of addition


1) Integer addition.

a) Positive integer addition. e.g. 2+9=11

b) Negative integer addition. e.g. -2+9=7

2) Float addition

a) Positive float addition e.g. 2.1+9.1=11.2

b) Negative float addition. e.g. -2.2+9.2=7.0

3) Fractional number addition.

a) Positive fractional number addition. e.g. 2 1/2+9 1/2=12.

b) Negative fractional number addition.

e.g. -2 1/2+9 1/2=7.

4) Complex number addition.

a) Positive complex number addition. (2+3i)+(3+3i)=5+6i.

b) Negative complex number addition -(2+3i)+(3+3i)=1

I am dealing with positive integer addition.

A) PROBLEM DIFINITION

1) We want addition of two numbers of n digits. Which is in present defined up to some limit? Our aim is to extent up to n desired digits.

2) We can go for addition of n number of n digits.

E.g 24+24+25+36+14+15+25………………+35=

For base100 system.

E.g 145+2125+369+158+789+………………+245=

For base 1000 system.

As we see the addition n number of two digits and three digits. We can go for addition n number of n digits long.

AXIOM: (satish) Addition of two n digits number i.e. (a + b) gives the result in n digits or (n+1) digits.

Ex (1):-11+11=22. EXPLANATION:-Two digit no. add by two digit number should give the result in n i.e.2,for n+1 i.e.3 above result in two digit number.

Ex(2):-999+999=1998. EXPLANATION:-Three digit no. add by three digit number should give the result in n i.e. 3, for n+1 i.e. 4 above result in three digit number.

DISCRIPTION OF BASE:- We generally dill with base-10 number system in day today life. It deals with ten symbols each of one digit long. If we go for base100 system then we will deals with 100 symbols each of two digits long. Same manner we can go for base 1000, 10000……..up to n base n is multiple of 10.

Ex- In 100 number base system symbol will be 00, 01, 02, 03, 04…….99.

In 1000 number base system symbol will be 000, 001,002,003,004…….999.

In 10000 number base system symbol will be 0000, 0001,0002,0003,0004…….9999.

In 10^5 number base system symbol will be 00000, 00001,00002,00003,00004…….99999.



How we decide the base of any problem?

a):-We can choose the base as our desire (according to calculating limit of computer)

e.g.123456 in 100 base system 12│34│56 . In 1000 base system 123│456 .In 10,000 base systems 0012│3456 and so on.

E.g.57123458 in 100 base system 05│71 │23│45│58 .

In 1000 base system. 057│123│458.

In 10, 00 base systems 0005│7123│4558 and so on.

We make a partition according to base from left hand side

GENERATION OF GENERAL FORMULA:-BY APPLICATION OF ALGEBRA IN DECIMAL NUMBER SYSTEM:-

In decimal number:

1234

9999

In symbolic form:

1 2 3 4

↓ ↓ ↓ ↓

A1 A2 A3 A4

9 9 9 9

↓ ↓ ↓ ↓

B1 B2 B3 B4

(A1*10^3+A2*10^2+A3*10^1+A4*10^0)

+

(B1*10^3+B2*10^2+B3*10^1+B4*10^0

(A1+B1)10^3+(A2+B2)10^2+(A3+B3)10^1+(A4+B4)10^0

GENERAL ALGORITHM

In slot division result always found in slot of equal number of digits i.e. equal to base.

Base10

E.g. 1234+1234=2│4│6│8 e.g. 4321*4321=8│6│4│2

As we se in result each slot contain one element not more then that or less.

Base100

e.g. 1234*1234=24│68. e.g. 4321*4321=86│42.

As we se in result each slot contain two element not more then that or less.

Base1000

e.g. 1234+1234 = 002│468 e.g. 4321+4321= 008│642

As we se in result each slot contain three element not more then that or less.

Base10000

e.g. 1234+1234=0000│2468. e.g. 4321+4321=0000│8642.

As we se in result each slot contain four element not more then that or less.

Base100000

e.g. 1234+1234=00000│02468. e.g. 4321+4321=00000│08642.

As we se in result each slot contain four element not more then that or less.

Base n

General rule for number of element in slot in any base-10 number system.

Each slot will contain n element not more then that or less.

A):- Deeside the base of given number according to our wish or desire in slot

Ex:-base 10

1 0 1 1 1 0 1 1



3 4 1 1 3 4 1 1

Ex:-base 100

13567891113 & 34789410101 01 35 67 89 11 13



03 47 89 41 01 01

Ex:-base 10000

0001365789111131 0001 3657 8911 1131



100147894110101 1001 4789 4110 1011

B):Name each slot from left or right of no. as we wish, let take left to right for first no.

Ex:-from left to right

12345 23456 A1 A2

In symbolic form

23456 34567 B2 B1

C):-Apply formulae as per slot division

for

A1 A2

B2 B1

1):-(A1+B1)

2):-(A2+B2)

D1):-Step for base 100000

12345 23456 A1 A2

In symbolic form

23456 94567 B1 B2



1234523456+2345694567=3580218023…….(1)

FIND:-

a):-int (A1+B1/base)=cy1

E.g. int(23456+94567/10000)=1=cy1

b):-int [(A2+B2+CY1)/BASE] =cy2

E.g. int(12345+23456/10000)=0=cy2

D2):-FIND

a):-mod (A1+B1, base)=18023

b):-mod [(A2+B2++cy1), base] =35802.

c):-mod (cy2, base) =0

Print the result from bottom to top

35802│18023 ………………………………………….(2).

As (1) and (2) are same so our algorithm gives correct result.















Written By

Satish kumar singh ,

Number theory(prime numer)

B.E (Comp.Tech), R.F Engg,

GTL PVT

Mo no +91-9199516727

Sat.wnz@gmail.com

No comments:

Post a Comment