is_dotted_integer

mathtools.is_dotted_integer(argument)

Is true when argument is equivalent to a positive integer and can be written with zero or more dots. Otherwise false.

>>> for argument in range(16):
...     print('%s   %s' % (argument, mathtools.is_dotted_integer(argument)))
...
0         False
1         False
2         False
3         True
4         False
5         False
6         True
7         True
8         False
9         False
10        False
11        False
12        True
13        False
14        True
15        True

Returns true or false.

Integer n qualifies as dotted when abs(n) is of the form 2**j * (2**k - 1) with integers 0 <= j, 2 < k.