Newbie - Trying to Help a Friend

Neil Cerutti mr.cerutti at gmail.com
Tue Nov 19 20:07:35 CET 2013


bradleybooth12345 at gmail.com via python.org asks:
> A Friend is doing maths in University and has had some
> coursework to do with python.
>
> The question is
>
> "Write a program that calculates how many positive integers
> less than N are not divisible by 2,3 or 5. The user should be
> prompted to supply the Number N. Demonstrate your program
> output when the input N is your student id. (13006517)
>
> "The collatz process is as follows. Take a positive integer n
> greater than 1. while n is greater than 1 repeat the following;
> if N is even halve it and if N is odd multiply it by 3 and add
> 1. The (Unsolved) collatz conjecture is that this process
> always terminates.
>
> The user should be prompted to supply the number n, and your
> program should build the list of values taken by sucessive
> iteration of the algorithm, and print it out. For example, if 7
> is input your program should print the list
>
> [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
>
> Demonstrate your program output for an input value consisting
> of the number formed adding 10 to the last digit of your
> student id. (13006517)"
>
> Any help would be appreciated

What has A Friend written so far? Where are you stuck?

-- 
Neil Cerutti

On Tue, Nov 19, 2013 at 1:40 PM,  <bradleybooth12345 at gmail.com> wrote:
> Hi,
>
> A Friend is doing maths in University and has had some coursework to do with python.
>
> The question is
>
> "Write a program that calculates how many positive integers less than N are not divisible by 2,3 or 5. The user should be prompted to supply the Number N. Demonstrate your program output when the input N is your student id. (13006517)
>
> "The collatz process is as follows. Take a positive integer n greater than 1. while n is greater than 1 repeat the following; if N is even halve it and if N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that this process always terminates.
>
> The user should be prompted to supply the number n, and your program should build the list of values taken by sucessive iteration of the algorithm, and print it out. For example, if 7 is input your program should print the list
>
> [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
>
> Demonstrate your program output for an input value consisting of the number formed adding 10 to the last digit of your student id. (13006517)"
>
> Any help would be appreciated
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Neil Cerutti <mr.cerutti+python at gmail.com>



More information about the Python-list mailing list