Jump to content

Talk:Index finite lists of positive integers

From Rosetta Code

Sets or lists?

"It is known that the set of finite lists of positive integers is countable"
I know that the set of finite sets of positive integers is countable.
What is a list? If it is something like the example Perl is using "12 11 0 7 9 15 15 5 7 13 5 5", which is not a set, are these are countable?--Nigel Galloway (talk) 12:57, 8 September 2018 (UTC)

Yes.
Any list of finite integers may be represented as a set of finite integers:
A non-zero integer at position n in a list may be represented as the n-th odd prime raised to the power of the absolute value of that integer (with the result taking the sign of that integer).
A zero in position n in the list may be represented as 2 to the n-th power.
As these values are distinct this set representation will have the same number of elements as the original list.
As this set representation is a set of finite numbers, any constraint on the cardinality of the set must also hold for the original list. —Rdm (talk) 19:02, 8 September 2018 (UTC)

Positive Integers

Many of the examples illustrate lists of non-negative integers which include lists containing 0. Should the description of the task be changed to fit these examples, or the examples flagged as incorrect?

Cookies help us deliver our services. By using our services, you agree to our use of cookies.