cmatrix.complement_at

cmatrix.complement_at()

Utility function computing the complement from x and base.

Parameters

type

Description

x

int

the value to base-complement

base

int

the numeric base as reference

(2 by default)

Returns
int

the 1st level complement (on one digit)

Examples

>>> num=7
>>> base=10
>>> cp=complement_at(num,base)
>>> print(cp)
2
>>> num=2
>>> base=3
>>> cp=complement_at(num,base)
>>> print(cp)
0