17
1
Some background
In math, a group is a tuple (G, •) where G is a set and • is an operation on G such that for any two elements x and y in G, x • y is also in G.
For some x, y, z in G, basic group axioms are as follows:
- G is closed under •, i.e. x • y in G
- The operation • is associative, i.e. x • (y • z) = (x • y) • z
- G has an identity element, i.e. there exists e in G such that x • e = x for all x
- The operation • is invertable, i.e. there exist a, b in G such that a • x = y and y • b = x
Okay, so those are groups. Now we defined an Abelian group as a group (G, •) such that • is a commutative operation. That is, x • y = y • x.
Last definition. The order of a group (G, •), denoted |G|, is the number of elements in the set G.
Task
The Abelian orders are the integers n such that every group of order n is Abelian. The sequence of Abelian orders is A051532 in OEIS. Your job is to produce the nth term of this sequence (1-indexed) given an integer n. You must support input up to the largest integer such that nothing will overflow.
Input can come from function arguments, command line arguments, STDIN, or whatever is convenient.
Output can be returned from a function, printed to STDOUT, or whatever is convenient. Nothing should be written to STDERR.
Score is number of bytes, shortest wins.
Examples
Here are the first 25 terms of the sequence:
1, 2, 3, 4, 5, 7, 9, 11, 13, 15, 17, 19, 23, 25, 29, 31, 33, 35, 37, 41, 43, 45, 47, 49, 51
1Related. – Martin Ender – 2015-12-27T23:38:31.673