Talk:Index finite lists of positive integers: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "==Sets or lists?== "It is known that the set of finite lists of positive integers is countable"<br>I know that the set of finite sets of positive integers is countable.<br>Wha...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==Sets or lists?==
==Sets or lists?==
"It is known that the set of finite lists of positive integers is countable"<br>I know that the set of finite sets of positive integers is countable.<br>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, I don't think these are countable.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 12:57, 8 September 2018 (UTC)
"It is known that the set of finite lists of positive integers is countable"<br>I know that the set of finite sets of positive integers is countable.<br>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?--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk: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. —[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 19:02, 8 September 2018 (UTC)

Latest revision as of 19:02, 8 September 2018

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)