In and Out

*k*-ary Divisors

**Q: **The -ary divisors of , written , are defined at mathworld.wolfram.com/k-aryDivisor.html. How can I implement ?

**A: **A divisor of a number is a number which divides (written ), also called a factor. The divisors of , that is , are computed using Divisors. Here are the divisors of 12.

It is straightforward to implement the notation .

Clearly 3 divides 12.

A 1-ary or *unitary* divisor (mathworld.wolfram.com/UnitaryDivisor.html) of satisfies , that is is relatively prime to or . divisors[1] [*n*] computes, and caches, the list of unitary divisors of , .

Here are the unitary divisors of 12.

Define the notation .

In this notation, a divisor of is written .

Here are the unitary divisors for the first few integers (Sloane's A077610).

For a prime power , the unitary divisors are 1 and [1].

2 is a divisor but not a unitary divisor of 12.

is called a -ary divisor of , written , if the greatest common -ary divisor of and is 1. Recursive implementation, using caching, is straightforward.

Here are the 2-ary or *biunitary** divisors* for the first few integers.

For a prime power , the biunitary divisors are except for when is even [1].

Here are the -ary divisors of for . One observes that a fixed point is attained.

A divisor of is called *infinitary*, , if it is a product of divisors of the form , where is a prime power dividing and is the binary representation of (see Sloane's A037445). The infinitary divisors are then those factors that have zeros in the binary representation of all where itself does. This can be directly coded using BitOr.

is an infinitary divisor of (with ) if [1].

Here are the infinitary divisors for the first few integers.

Taking the logarithm base of the infinitary divisors of gives the values for which are infinitary divisors of .

Here is a plot of the infinitary divisors of , computed with but valid for arbitrary , for . Showing the last (decimal) digit of enables the actual divisors to be read off easily [1].

The appearance of the Sierpinski sieve fractal mathworld.wolfram.com/SierpinskiSieve.html is interesting.