Завершен Опубликован 3 года (лет) назад Оплачивается при доставке
Завершен Оплачивается при доставке

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.



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


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


ID проекта: #24387919

О проекте

15 заявок(-ки) Удаленный проект Последняя активность 2 года (лет) назад



Hello, I am interested in the project. I will implement the code with object oriented style in order to be easier to extend the functionality of the code later. Best Regards John

$30 USD за 2 дней(-я)
(64 отзывов(-а))

15 фрилансеров(-а) готовы выполнить эту работу в среднем за $44


Dear Sir, Greetings! Your requirements seems absolutely doable by us. We are an established IT company having 16+ years of working experience doing Core PHP/MySQL and Wordpress (experienced with - with the theme/ th Больше

$20 USD за 7 дней(-я)
(185 отзывов(-а))

Hello I have several years of experience with PHP, I have checked these requirements and it looks pretty easy to complete

$20 USD за 1 день
(409 отзывов(-а))

HI i understand all od your math code and i will write code for you in less code. give me your project to do it right now. Thanks Waqas

$50 USD за 7 дней(-я)
(70 отзывов(-а))

Hi Werner, Thanks for reading my response to your project. I saw your project and it matches my expertise. I am Expert in Mathematics. Web Development is my profession in the last 5 years. I am the owner of Stantech So Больше

$50 USD за 2 дней(-я)
(41 отзывов(-а))

Hey I can help you out! whats your budget and timeframe for this? I'm a very seasoned PHP developer (I can do frontend aswell)

$10 USD за 1 день
(31 отзывов(-а))

Hello, ⭐⭐⭐⭐⭐ i am interested in this project , can begin now waiting your answer on chat Regards ⭐⭐⭐⭐⭐

$30 USD за 1 день
(72 отзывов(-а))

Hello, I am php developer with 7 years of experience i can check your job description i can do this math script please message me for details Thanks Jaffer I.

$29 USD за 1 день
(41 отзывов(-а))

Hello Sir/Madam CodingHelpLine assists in various programming languages including Java Technologies, C#, C/C++, PHP, Node, Android, Python, JavaScript, Scala, Vb.Net, XML and various frameworks. I can help implement a Больше

$30 USD за 1 день
(9 отзывов(-а))

Oh my goodness, it's the Collatz Conjecture! I recognized it right away! I'd love to work on this with you. I've had a fascination with it for a long time and would love to help out in any way I can. Oh, and I know PHP Больше

$20 USD за 4 дней(-я)
(8 отзывов(-а))

Hi, I'm interested in your project. The algorithm you gave is clear. If you choose to work with me we'll have to clear up some details about the settings. Kind regards.

$25 USD за 1 день
(4 отзывов(-а))

I'm interested on this project. Please give me a chance to prove. I will give the code with possible test cases in excel Thanks in advance. Regards, Deepika

$20 USD за 3 дней(-я)
(0 отзывов(-а))

Hi, ** UPDATE ** The example is ready. When interested to see let us know by sending a chat message and we will share the url with you to view. We can create this math script for you and in the future expand it to y Больше

$25 USD за 1 день
(0 отзывов(-а))