Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

dit View Insert Format earch Alt +5 Tendt Math Drawing Plot Animation Hide P Normd Iteration Times New Roman ? 12-E B 1 U ???

image text in transcribed

dit View Insert Format earch Alt +5 Tendt Math Drawing Plot Animation Hide P Normd Iteration Times New Roman ? 12-E B 1 U ??? The famous 3x +1 problem ? Exercises Part 1. Ifn people (numbered I to n) stand in a cirde and someone starts going around the airde and eliminating every other person till only one person is left, the number J(n) of the person left at the end is given by J(n) 1 J(n) 2*J(n/2)-1 ifn>1 and n is even if n>1 and n is odd J(n) 2"J((n-1)y2) +1 6) Write a recursiveprocedure to compute J. [As a check the first 16 values (starti 11,13,15,1] (i)Compute the value of J(10000). (ii) Can you explain why this is so much faster than our recursive procedure to compute the n-th Fibonacci number? ng with 1) of J(n) are 1,1,3,1,3,5,7,1,3,5,7,9 , [Remark The problem above is a special case of the Josephus eliminate every 3rd person, every 4th person, etc. For more on the history and generalizations of this problem see Concrete Mathematics-A Foundation for Computer Science, by Graham, Knuth and Patashnik, Chapter 1. You will also find a number of webpages and mathematics papers devoted to this problem if you search on Jos engine or via MathSciNet- click on home page from a USF computer--to use MathSciNet] Problem. Instead of eliminating every other person, one could Josephnus Problem via a search Mathematical Links at the bottom of the USF Mathematics Department's Part 2 Write a procedure using the variable args that will take an unspecified finite number of numbers del largest and return the aver say: "There are not enough arguments. There should be at least three." ete the smallest and the age of the rest as a floating point number. If there are fewer than 3 arguments have an error messag You should have no input parameters in the definition of the procedure. You may write it directly or command sort as a part of your program. see ho argument sequences: Do 2sort to see how sort works. Test your procedure with each of the following you may use the Maple 50,40,40, 40, 40, 10 1,2 seq(100 -i, i 1.100) seq(modpin, 111), n1.1000)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions