Question

A tuple, unlike a multiset, has an order: (1,2,1) is different than (1,1,2). Define the sum...

A tuple, unlike a multiset, has an order: (1,2,1) is different than (1,1,2). Define the sum of a tuple as the sum of all the elements in that tuple. For instance, the sum of (1,1,2) is 4. Using the elements of S, how many tuples of size 4 can be made that sum to 5? For example,(1,2,1,1), (2,0,0,3) and (0,3,0,2) are such tuples.

S = {0, 1, 2, 3, 4}

Homework Answers

Answer #1

total 52 tuple possible.

(4 1 0 0 ),(4 0 1 0),(4 0 0 1),(1 4 0 0 ),(0 4 1 0),(0 4 0 1),(1 0 4 0),(0 1 4 0),(0 0 4 1),(1 0 0 4),(0 1 0 4),(0 0 1 4)

(3 2 0 0) (3 0 2 0) (3 0 0 2) (2 3 0 0)(0 3 2 0) (0 3 0 2 ) (2 0 3 0) (0 2 3 0)(0 0 3 2) (2 0 0 3)(0 2 0 3)(0 0 2 3)

(2 2 1 0)(2 2 0 1)(2 1 2 0)(2 1 0 2)(2 0 1 2)(2 0 2 1)(1 2 2 0)(1 2 0 2)(1 0 2 2)(0 2 2 1)(0 2 1 2)(0 1 2 2)

(1 1 1 2)(1 1 2 1)(1 2 1 1 )(2 1 1 1)

(3 1 1 0)(3 1 0 1)(3 0 1 1)(1 3 0 1)(1 3 1 0)(0 3 1 1)(0 1 3 1)(1 0 3 1)(1 1 3 0)(0 1 1 3)(1 0 1 3)(1 1 0 3)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1-Create a week_tuple and assign the days of the week as strings to the week_tuple. b....
1-Create a week_tuple and assign the days of the week as strings to the week_tuple. b. Print out the elements in the week_tuple. 2-a. The following list has been declared as follows: credit_list = [24,3,15] b. Convert the credit_list to a tuple named credit_tuple. c. Print out the elements in the credit_tuple. 3-a. Write an initialize_list_values function that takes in a number for the number of elements in a list and an initial value for each element. The function creates...
Suppose that the set S has n elements and discuss the number of subsets of various...
Suppose that the set S has n elements and discuss the number of subsets of various sizes. (a) How many subsets of size 0 does S have? (b) How many subsets of size 1 does S have? (c) How many subsets of size 2 does S have? (d) How many subsets of size n does S have? (e) Clearly the total number of subsets of S must equal the sum of the number of subsets of size 0, of size...
2. Define a relation R on pairs of real numbers as follows: (a, b)R(c, d) iff...
2. Define a relation R on pairs of real numbers as follows: (a, b)R(c, d) iff either a < c or both a = c and b ≤ d. Is R a partial order? Why or why not? If R is a partial order, draw a diagram of some of its elements. 3. Define a relation R on integers as follows: mRn iff m + n is even. Is R a partial order? Why or why not? If R is...
a) sum = 0 for letter in '12345' : sum = sum + int(letter) print('sum =...
a) sum = 0 for letter in '12345' : sum = sum + int(letter) print('sum = ', sum) Write a program which reads a string containing any characters from the user and prints the sum of the digits in the string. For example, if the string from the user is "I want 3 oranges and 24 bananas', then the output would be 9, since 3 + 2 + 4 = 9. Note that a character C is a digit if...
All these to be done in MATLAB: 1.1)Define a column vector, called “b” in MATLAB that...
All these to be done in MATLAB: 1.1)Define a column vector, called “b” in MATLAB that stored floating point numbers between 0.6 to 2.5 in increment of 0.2. 1.2)What is the size of vector b? How is the size of ‘b’ stored? Define number of rows of ‘b’ in variable ’row’ and number of columns of “b” in variable “col”. 1.3)Define matrix “A” as a 10 by 10 matrix of all “1”s. 1.4)Update matrix “A” as following: set all the...
c) A function named tallied_data() that takes in a nested list (Use this on the data...
c) A function named tallied_data() that takes in a nested list (Use this on the data from part 1, but it should be able to be used to solve similar problems), indices for two columns and returns a tallied list. The inputs are: i) a nested list, ii) an index for the ‘reference column’/ ‘category’ (col_ref) iii) another index for the column to be tallied (col_tally) iv) this function returns a list of tuples where each element is a tuple...
Circular Permutations and Permutations with Similar Elements 1) In how many ways can three people be...
Circular Permutations and Permutations with Similar Elements 1) In how many ways can three people be made to sit at a round table? 2) In how many ways can three couples be seated at a round table, so that men and women sit alternately? 3) In how many ways can five keys be put on a key ring? 4) Find the number of different permutations of the letters of the word MATHEMATICS. 5) How many different ways can three pennies,...
A python question... In your class, many students are friends. Let’s assume that two students sharing...
A python question... In your class, many students are friends. Let’s assume that two students sharing a friend must be friends themselves; in other words, if students 0 and 1 are friends and students 1 and 2 are friends, then students 0 and 2 must be friends. Using this rule, we can partition the students into circles of friends. To do this, implement a function networks() that takes two input arguments. The first is the number n of students in...
2. There is a famous problem in computation called Subset Sum: Given a set S of...
2. There is a famous problem in computation called Subset Sum: Given a set S of n integers S = {a1, a2, a3, · · · , an} and a target value T, is it possible to find a subset of S that adds up to T? Consider the following example: S = {−17, −11, 22, 59} and the target is T = 65. (a) What are all the possible subsets I can make with S = {−17, −11, 22,...
In Python: Sublist of list A is defined as a list whose elements are all from...
In Python: Sublist of list A is defined as a list whose elements are all from list A. For example, suppose list A = [0, 1, 2, 3, 4, 5, 6], its has many sublists and one of them is [0, 1, 3] because elements 0, 1 and 3 are all contained in list A. Define a function named returnComplement that accepts two integer lists as the parameter (one of the list is the sublist of the other). Suppose names...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT