A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [set-theory]

Set theory is the branch of mathematics that studies unordered collections of objects. Challenges with this tag will involve the manipulation or analysis of sets.

12 questions
Filter by
Sorted by
Tagged with
1k views

Natural construction

The natural numbers including 0 are formally defined as sets, in the following way: Number 0 is defined as the empty set, {} For n ≥ 0, number n+1 is defined as n ∪ {n}. As a consequence, n = {0, 1, ...
2k views

Cartesian product of two lists

Task Given two lists of characters, output their Cartesian product, i.e. the list of pairings of each letter from the first list with each letter from the second list. Example ...
2k views

Length of String Using Set Theory

From Wikipedia Set-theoretic definition of natural numbers The set N of natural numbers is defined as the smallest set containing 0 and closed under the successor function S defined by S(n) = n ∪ ...
807 views

Permutation Numbering

The Challenge For a given set of n integers, write a program which will output its lexicographic index. The Rules The input must only be a set of unique non-negative integers separated by spaces. ...
806 views

Laver table computations and an algorithm that is not known to terminate in ZFC

The Laver tables provide examples of programs which have not been shown to terminate in the standard axiomatic system of mathematics ZFC but which do terminate when one assumes very large cardinal ...
737 views

Print the intersection of sequences

Sequences You are given four number sequences, numbered 1 through 4. OEIS The location of 0...
6k views

Golf a Venn Diagram generator

Golf a Venn Diagram generator In order to properly celebrate John Venn's 180th birthday, today your task will be creating a program that outputs a Venn Diagram! Input: A positive integer ...
3k views

Is it a sum-free set?

A set is sum-free if no two (not necessarily distinct) elements when added together are part of the set itself. For example, {1, 5, 7} is sum-free, because all ...
1k views

Uniquify Identifiers

Introduction By definition, unique identifiers should be unique. Having multiple identifiers that are the same causes one to retrieve unexpected data. But with data arriving concurrently from ...
750 views

Operations on Sets

Note: I have accepted an answer, but I'm willing to accept a better answer if it comes. Write a program that computes operations on sets. You may take input either from standard input or from command ...