encyclopegia.org

Ruler function

In number theory, the ruler function of an integer n can be either of two closely related functions. One of these functions counts the number of times n can be evenly divided by two, which for the numbers 1, 2, 3, ... is Alternatively, the ruler function can be defined as the same numbers plus one, which for the numbers 1, 2, 3, ... produces the sequence As well as being related by adding one, these two sequences are related in a different way: the second one can be formed from the first one by removing all the zeros, and the first one can be formed from the second one by adding zeros at the start and between every pair of numbers. For either definition of the ruler function, the rising and falling patterns of the values of this function resemble the lengths of marks on rulers with traditional units such as inches. These functions should be distinguished from Thomae's function, a function on real numbers which behaves similarly to the ruler function when restricted to the dyadic rational numbers. The 0-based ruler function is also known as the 2-adic valuation of its argument, and gives the position of the bit that changes at a given step of the Gray code. The sequence of values of the ruler function is the lexicographically earliest infinite square-free word over the natural numbers.…

In number theory, the ruler function of an integer n can be either of two closely related functions. One of these functions counts the number of times n can be evenly divided by two, which for the numbers 1, 2, 3, ... is Alternatively, the ruler function can be defined as the same numbers plus one, which for the numbers 1, 2, 3, ... produces the sequence As well as being related by adding one, these two sequences are related in a different way: the second one can be formed from the first one by removing all the zeros, and the first one can be formed from the second one by adding zeros at the start and between every pair of numbers. For either definition of the ruler function, the rising and falling patterns of the values of this function resemble the lengths of marks on rulers with traditional units such as inches. These functions should be distinguished from Thomae's function, a function on real numbers which behaves similarly to the ruler function when restricted to the dyadic rational numbers. The 0-based ruler function is also known as the 2-adic valuation of its argument, and gives the position of the bit that changes at a given step of the Gray code. The sequence of values of the ruler function is the lexicographically earliest infinite square-free word over the natural numbers. In the Tower of Hanoi puzzle, with the disks of the puzzle numbered in order by their size, the 1-based ruler function gives the number of the disk to move at each step in an optimal solution to the puzzle. A simulation of the puzzle, in conjunction with other methods for generating its optimal sequence of moves, can be used in an algorithm for generating the sequence of values of the ruler function in constant time per value.

References

No reference rows published for this article.

Cite this article

MLA

"Ruler function." encyclopegia.org, 2026, https://encyclopegia.org/wiki/ruler-function. Accessed 24 November 2026.

Chicago

"Ruler function." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/ruler-function.

APA

encyclopegia.org. (2026). Ruler function. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/ruler-function

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Weyl's inequality (number theory)

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1374725678 · 0.5 · snapshot enwiki-001374725678

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.