Closed

Egyptian Multiplication and SDLList class

The ancient Egyptians knew how to work with fractions but saw beauty in

representing fractions as a sum of distinct unit fractions (fractions

whose numerator equals 1). For example, the ancient Egyptians would

represent the fraction ľ as

1/4 + 1/5 + 1/6 + 1/20 + 1/21 + 1/30 + 1/420

This can be accomplished by starting with an SDLList<BigInteger>

consisting of three fours [4, 4, 4] which represents Ľ + Ľ + Ľ. Note that

it is necessary to store only the denominators. The idea is to remove a

duplicate integer x from the SDLList and replace it by adding the integers

x+1 and x(x+1). [Word of warning: you will have to use the methods add()

and multiply() from BigInteger]. Why does this process work? The reason is

1/x = 1/(x+1) + 1/[x(x+1)].

Let’s complete this example. By showing the contents of the SDLList after

each duplicate is removed.

[4, 4, 4] remove 4 add 5 and 20

[4, 4, 5, 20] remove 4 add 5 and 20

[4, 5, 5, 20, 20] remove 5 add 6 and 30

[4, 5, 6, 20, 20, 30] remove 20 add 21 and 420

[4, 5, 6, 20, 21, 30, 420] each entry is distinct

The EgyptianFraction class should have instance variables

private SDLList<BigInteger> representation;

private BigInteger numerator;

private BigInteger denominator;

You will need methods to

1) detect duplicate items in the

SDLList

2) remove a duplicate from the SDLList

3) print the representation of an

Egyptian Fraction,

as well as, a constructor that initializes the SDLList based on the

inputted fraction.

Skills: Java

See more: representation integers, n equals, integers and, work integers, biginteger, unit work, java fraction, add multiply java, 420, java detect, 318, word replace, fraction java, remove duplicate, equals, representation, add detect, ancient egyptian, multiplication, java entry, egyptianfraction, word java, integers, sum biginteger, store biginteger

About the Employer:
( 0 reviews ) Delhi, India

Project ID: #529161

7 freelancers are bidding on average $97 for this job

rakib062

Hello sir, This is a very easy algorithmic problem.I can do the job with your full satisfaction.I can start right now. Thanks.

$30 USD in 1 day
(14 Reviews)
3.9
dmantampfl

I can do this project, please check PM

$50 USD in 2 days
(5 Reviews)
3.1
Schurin

Hello. Please check the PM. Thanks.

$100 USD in 1 day
(3 Reviews)
2.8
ramana123

Hi, I am having 4.5 yrs of exp. in java/j2ee related technologies. I can develop this for you. Looking forward to hear from you. Thanks, Venkat Reddy

$150 USD in 3 days
(0 Reviews)
0.0
Ahmedhiedar

HSBC money transfer or western union

$200 USD in 7 days
(0 Reviews)
0.0
sydubabu

I will complete this task within 20 days

$150 USD in 20 days
(0 Reviews)
0.0
crazysoft127

Can start right now

$50 USD in 0 days
(0 Reviews)
0.0
cpeosphoros

Very nice problem. I'm a maths grad student and can do it easily. The 10 days timeline is just padding for any eventuality. I will moat likely finish it early.

$50 USD in 10 days
(0 Reviews)
0.0