Closed

(PHP) MATHS SCRIPT III

i need a skilled coder to write me a program in php which will compute values on the screen and transfer them into a grid.

Program

------------------

take any number and apply the following rules

1. If the number is EVEN divide it by 2.

2. if the number is ODD, multiply it by 3, then ADD 1 to the result, then divide this result by 2.

3. if the number is = 1, STOP.

Rule 3 is important and our goal is to reach 1 when we reach 1 the program will stop executing.

Example 1 (EVEN)

suppose we start with x = 4.

applying the rules will mean

x = 4 is EVEN so rule 1 applies again and we go from 4 to 2

x = 2 is EVEN so rule 1 applies again and we go from 2 to 1

x = 1 so rule 3 applies and we STOP.

the full sequence generated is {4,2,1}

Total Elements in the sequence is 3.

Total Iterations to reach the goal (=1) is 2.

Note Total Iterations to reach 1 is always 1 less than total elements in the sequence.

Special case of x =1 we are already at 1 so we stop (i.e not even start) so the sequence is technically {1} and the Iterations to reach goal is 0.

Example 2: (ODD)

x = 3.

x= 3 is ODD so Rule 2 applies and 3 maps to (3(3) + 1) / 2 = (10/2) = 5

x= 5 is ODD so Rule 2 applies and 3 maps to (3(5) + 1) / 2 = (16/2) = 8

x= 8 is EVEN so Rule 1 applies and 8 maps to (8) / 2 = 4

x= 4 is EVEN so Rule 1 applies and 8 maps to (4) / 2 = 2

x= 2 is EVEN so Rule 1 applies and 8 maps to (2) / 2 = 1

x= 1 so Rule 3 applies and we STOP.

Sequence generated = {3,5,8,4,2,1}

Total Elements in the sequence is 6.

Total Iterations to reach the goal (=1) is 5.

Your job

write a phpscript which will

1. ask for a starting number x (e.g 3)

2. ask for a GOAL (default is 1)

3. compute the iterates i.e. 5,8,4,2,1 using the 3 rules above

4. STOP the program when the GOAL is reached

4. output the sequence of iterates on the screen

5. output total number of iterations to reach 1.

e.g suppose i enter 3 into the box and press RUN then

the program will run and the output will be

Sequence for x= 3: {3,5,8,4,2,1}

Iterations to reach Goal (=1): 5

Note: id like u to allow me to alter the rules too, example EVEN RULE x -> x/2 by default but i might decide to make it x-> 2x so we would have a box and i can enter a scalar multiple example 2 or 0.5

similarly for ODD RULE we can have a box to enter 2 values e,g the odd rule is 3X +1 / 2

i could say 7X + 5 or 11X + 7 / 2 so theres 3 values can be modified

the general formula is (AX + B) / C. i am free to choose any A,B,C

default will be A=3 B=1 C=2

Regards.

PLEASE NOTE i will need further work done on this so please if u do this properly i can give u more work

We can store answers in the DB also if we want. for research and to study the numbers

Skills: PHP, JavaScript, MySQL, HTML

See more: run php script data update, run php script update, run php script automaticly, php script connect telnet run commands, random digit numbers php script, unable run php script misconfiguration, php run php script automatically, schedule php script run, php script run automatically, run php script time xml feed checked, php script list numbers, php script reads numbers, run automaticly php script web page, write php script collect numbers 100, php script collect numbers 100, php script connect ssh run commands, run php script automatic, run php script visual foxpro

About the Employer:
( 12 reviews ) Clydebank, United Kingdom

Project ID: #28403224

28 freelancers are bidding on average $123 for this job

developersshop

Respected Sir!, I'm an expert Developer and Designer of having 6+ years of experience in development and Designing. I am readily available to work with you in your project (PHP) MATHS SCRIPT III as per your needs. Let More

$220 USD in 2 days
(124 Reviews)
6.4
popnicolaef

Hello I understood fully for you requirement. I can do it. I love math and number

$200 USD in 1 day
(56 Reviews)
5.6
greatswork

Hi, I have reviewed the project description, I am an expert designer in the field and have 10 years of experience. I have skills in wordpress, PHP, AJAX, workerMan, .NET CORE, Aspx, HTML5, JSP, RUBY, Vuejs, JavaScript, More

$200 USD in 1 day
(12 Reviews)
4.9
dmabdeveloper

Dear Patrick. Nice to meet you. I've just read your job description carefully and I feel this project is best fit to my skill and experiences. So I think that I can finish your work perfectly as you need. I have many e More

$100 USD in 7 days
(10 Reviews)
5.0
bobrovpavelwork

High Quality + Fast Speed = Excellent Result + Business Success, this is my work-ing style. I have gone through your Job post and I can understand your job requirement thoroughly. As a talented developer, I have a tota More

$140 USD in 1 day
(22 Reviews)
5.5
ITServices24y7

Hello Dear, I have read your post for "MATHS SCRIPT" which will compute values on the screen and transfer them into a grid. I read your post carefully & will provide you a Formulating Script along with a BD for storing More

$130 USD in 1 day
(3 Reviews)
4.2
chiguy2

Hi, dear I am a Full stack developer and have rich experience in web development. so I can complete your project successfully You can check my previous works. Please send me a message. Thanks

$140 USD in 7 days
(7 Reviews)
4.3
zimenkoilya2

✨⭐⭐Dear Employer⭐⭐✨ This is ilya and I have just read your job posting and read your requirements with care, I have been working as a software developer for over 5 years and have many experiences with ✔ WEBSITE DESIG More

$30 USD in 2 days
(10 Reviews)
4.1
rociobc12

Hello! I Can Complete It TOday - Perfectly! ★★★★★ The Best PHP Developer ★★★★★ I read your job description carefully and I understand what you want. I'm a Professional PHP Developer with 6+ years of experience and wi More

$50 USD in 1 day
(12 Reviews)
4.3
nikolai198061

Hi, I can make PHP script within next few hours as your Algorithm. As a senior PHP, C, Python developer, I have rich experiences in Algorithm, PHP. I am very interested in your project and ready to start work right now More

$100 USD in 7 days
(8 Reviews)
3.9
rahadkp50

Hi, I am expert PHP, mySql Developer and confident about your project to make a script which will compute values on the screen and transfer them into a grid. I can easily do this . I am the best person for this job. I More

$50 USD in 1 day
(16 Reviews)
4.1
romansydorenko07

Hello, Patrick ⭐ ⭐ ⭐ ⭐ ⭐ PHP expert and MATH master ⭐ ⭐ ⭐ ⭐ ⭐ I have a specialty in Website Development. You will be fascinated by my skills. I'd like to help and finish your project. So, I think that I can complete More

$140 USD in 7 days
(4 Reviews)
3.7
hladunkonstantyn

Hi, Patrick I read your description and I understand what you want As a top developer, I can do it in short time If you hire me, you will get good result Please contact me Thanks, Kostyantyn

$140 USD in 1 day
(9 Reviews)
3.7
tyomkhachatryan

Hi, Sir. How are you? I have read your proposal in detail and I am sure I can do this in 1 day. Please send a message so that we can start discussing. Thank you

$140 USD in 1 day
(1 Review)
3.5
DmitriiTols

Hello there! I am an expert in Web and Mobile app development with 8 + years of experience. I have vast experience in this field and have done many social apps, e-commerce apps, etc.. I am very confident about this p More

$50 USD in 1 day
(11 Reviews)
3.7
amrafifi73

Hi, Please choose me. I can carryout this task in 3 hours perfecty. When I receive your asking, I will start this work soon. Looking forward to hearing from you soon. Best regards.

$30 USD in 1 day
(3 Reviews)
3.4
FlorinAlexandruP

❤❤❤❤❤❤❤ Algorithm and Full Stack Developer ❤❤❤❤❤❤❤ Hello, Nice to meet you. Pls check following code. ========= PHP Code ========= function calFunction($x) { if($x == 1) return $x; if($x % 2 == 0 More

$100 USD in 1 day
(3 Reviews)
3.5
technonazmul

Hi, I have read your job description and I think I am a perfect fit for your project. I can provide you with best results in no time. Inbox me to discuss further about it. Kind Regards Nazmul

$140 USD in 7 days
(6 Reviews)
3.1
jcaff999

Dear sir! I'm interested in your project. I have experience with 5 years experience of PHP. I can finish your project on time. I hope to work on the project with you. Regards.

$30 USD in 1 day
(22 Reviews)
3.2
eunoia0107

Hello, How are you today? Thank you for posting this project, and I'm very happy to bid your project. I've read carefully your project details. I have rich experiences related with your project. I can be a good cand More

$140 USD in 3 days
(9 Reviews)
2.7