Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++11,(function gcd was done. u only need to call it in the funtion phi, I just want to see how to print the totative

In C++11,(function gcd was done. u only need to call it in the funtion phi, I just want to see how to print the totative list and the totative count.) Write a function phi that takes a single long argument and returns a long, the totative count for the range from 1 argument.

a. Note that the function will have to print the totatives as they are found. b. Each number in the totative list is separated from its neighbor by one space.

Here is an example. Let us say we would like to calculate j(9). We would check every integer between 1 and 9 and observe the following:

- the gcd (1,9) is 1, 1 is a totative of 9, j is 1

- the gcd (2,9) is 1, 2 is a totative of 9, j is 2

- gcd (3,9) is 3, 3 is not a totative of 9, no change to j

- etc. In this sequence 3,6,9 are not totatives of 9 (they all have a gcd 1),

j(9) has a value of 6 and the totative list of 9 is 1,2,4,5,7,8.

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions