Write and test a c implementation of the mobius function

Assignment Help Computer Engineering
Reference no: EM132214030

Write and test a C implementation of the Mobius function M(n) defined as follows

M(n) = 1 if n = 1

= 0 if any prime factor is contained in N more than once

= (-1)p if n is the product of p different prime factors

Examples

M(78) = -1 78 = 2 * 3 * 13

M(34) = 1 34 = 2 * 17

M(45) = 0 45 = 3 * 3 * 5

The first values of M(n) are shown in this table n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

M(n) 1 -1 -1 0 -1 1 -1 0 0 1 -1 0 -1 1 1 0 -1 0 -1 0

Extra credit: Using random numbers, estimate the probabilities that M(n) returns -1, 0, +1

Reference no: EM132214030

Questions Cloud

Find the cyclic rotation that is the smallest lexicographic : Write a SuffixArray client that, given a string, finds the cyclic rotation that is the smallest lexicographically in linear time.
Write and test a data structures template : Write the template for an array of capacity =2 (default constructor) of unspecified type.
Calculate the number of elements in an array not counting : MSP430G2553 :Subroutine expects the Input on the stack as shown above: The input is the starting address of an array consisting of word length elements.
Remove occurrences of a given character in a string : Write a subroutine in assembly that removes occurrences of a given character in a string if it is after or before the space.
Write and test a c implementation of the mobius function : Write and test a C implementation of the Mobius function M(n) defined as follows.
Determine your clients net capital gain or net capital loss : HI6028 Taxation Theory, Practice & Law - Advise Rapid-Heat of its FBT consequences arising out of the above information, including calculation of any FBT
Write the assembly language for the subroutine : Write the assembly language for the subroutine (called by a main program) and simulate using the sample data table: 24, 65, F0.
Write a template function that receives a contact vector : Write a main function to test this function. In the main function create three different vectors of the types, int, double and char.
Write a template class which represent a mathematical set : Write a template class called ValSet, which represents a mathematical set of values.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a program to infer the key based on the assumption

Write a program to infer the key, based on the assumption that frequency of occurrence of each character in odd positions should be roughly equal to frequency.

  Contain reference slide with citations in apa format

build a 5- to 7-slide Microsoft?PowerPoint?presentation detailing the evolution of programming languages. Organize your slide presentation in the form of a timeline, and discuss the various generations of programming language.

  Write a program that creates two airplane objects

Write a C++ program that creates two airplane objects, plane1 and plane2 and then invokes methods to fly the planes at a particular speed.

  Make sure that the procedure can return the result

Write a PL/SQL procedure that will compute XY+1. Make sure that the procedure can return the result of the computation .

  Write a program in java for the deque data structure

Write a program in Java for the deque data structure. All the above operations should take O(1) time per operation.

  Write program that simulates the operation of a busy airport

Write a program that simulates the operation of a busy airport that has only two runways to handle all takeoffs and landings.

  Write a function to compare two c-strings for equality

Write a function to compare two C-strings for equality. The function should return true if the strings are equal and false if they are not.

  Determining average degree of vertex

For the random geometric graph, G(n, r), determine the average degree of the vertex: At least distance r from the boundary,

  Prepare power point presentation on different conflicts

PowerPoint Presentation based on four different conflicts you have encountered. These conflicts can be work related or personal conflicts.

  Describe in detail an implementation of a priority queue

Describe in detail an implementation of a priority queue based on a sorted array. Show that this implementation achieves O(1) time for operations min.

  Construct the state diagram for the finite-state machine

Find the output for each of these input strings when given as input to the finite-state machine in Example.

  Identify the major deliverables or tasks for the project

Identify the major deliverables/tasks for the project. Determine the detailed tasks necessary to complete each deliverable/major task.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd