TI-BASIC: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.
Rounding
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 Concatenation – DarkerLine
Returns the number formed by concatenating positive integers M and N.
N+M10^(1+int(log(N
Number of Digits in Nonzero Integer
If X is always positive, remove the "abs(".
1+int(log(abs(X
Number of Digits in Decimal Number – Weregoose, lirtosiast
not(X)+sum(0 or fPart(abs(X10^(cumSum(binomcdf(13,0))-2-int(log(abs(X+not(X
Sum of Digits of Integer – DarkerLine, lirtosiast
If X is always nonnegative, remove the "abs(".
sum(int(10fPart(abs(X10^(-cumSum(binomcdf(13,0
Sum of Digits of Decimal Number – DarkerLine, lirtosiast
If X is always nonnegative, remove both "abs(". If nonzero, remove the "+not(X".
sum(int(10fPart(abs(X10^(cumSum(binomcdf(13,0))-2-int(log(abs(X+not(X