(PHP) MATHS SCRIPT III

Closed Posted 3 years ago Paid on delivery
Closed Paid on delivery

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

PHP JavaScript MySQL HTML

Project ID: #28403224

About the project

19 proposals Remote project Active 3 years ago

19 freelancers are bidding on average $130 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
(163 Reviews)
6.7
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
(48 Reviews)
6.1
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
(72 Reviews)
5.9
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
(29 Reviews)
5.9
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
(29 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
(28 Reviews)
5.6
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
(21 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
(14 Reviews)
6.0
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
(22 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
(14 Reviews)
5.0
hiteshsinghal8

Hello there, I will give you a demonstration within 12-15 hours Warm Regards Hitesh Singhal

$222 USD in 2 days
(28 Reviews)
4.9
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
(10 Reviews)
3.5
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.6
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
(15 Reviews)
3.2
nadezhda319

Dear Client. Hope you are doing well. ⭐⭐⭐Available NOW and Can start Immediately.⭐⭐⭐ High Quality + Fast Speed = Excellent Result + Business Success, this is my working style. I am a full-stack developer who has rich More

$250 USD in 2 days
(5 Reviews)
2.4
manuvelsubin

Hi, I hope you doing well. I have 8 year experience in Web Development using PHP, MySql. I read the requirement clearly, what is the expected output. I can check the 3 rules using PHP and display the output. If need More

$75 USD in 1 day
(6 Reviews)
2.7
impetus21

Hello, You want a Math application by which you can compute values on the screen and transfer them into a grid. You want functionality like- 1. If the number is EVEN divide it by 2, 2. if the number is ODD, multiply i More

$135 USD in 8 days
(1 Review)
2.9
bhargab3

Hi, I have experience of around 8 years. Now I am working with a in house Automation development team. Surely I can help you.

$30 USD in 7 days
(0 Reviews)
0.0