Number One-Liners

This page is dedicated to showcase small snippets of code may be useful. These small routines are designed to accomplish tasks involving numbers and their attributes. Unless specified, output is in Ans.


The int( command always rounds towards -∞, and iPart( rounds towards 0. Here are the other two directions:

-int(-X                   //rounds towards +∞
iPart(X+not(not(fPart(X   //rounds away from 0

Number ConcatenationDarkerLine

Returns the number formed by concatenating positive integers M and N.


Number of Digits in Nonzero Integer

If X is always positive, remove the "abs(".


Number of Digits in Decimal NumberWeregoose, lirtosiast

not(X)+sum(0 or fPart(abs(X10^(cumSum(binomcdf(13,0))-2-int(log(abs(X+not(X

Sum of Digits of IntegerDarkerLine, lirtosiast

If X is always nonnegative, remove the "abs(".


Sum of Digits of Decimal NumberDarkerLine, lirtosiast

If X is always nonnegative, remove both "abs(". If nonzero, remove the "+not(X".


Fraction SimplifierBattlesquid

Simplifies fractions where A is the numerator and B is the denominator.

With Disp

Disp expr(Str1

With Output(


Alternatively, there is Xeda Elnara's method, but an abs command would have to be used to ensure that there is not a negative input.



Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License.