#Mathematica, 44 bytes
Mathematica, 44 bytes
If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&
Returns Null
for Terminating, True
for purely periodic, and False
for eventually periodic.
#Explanation
Explanation
RealDigits
Find the decimal expansion of N. (repeated digits are surrounded by an extra head List {}
).
ListQ@Last@#
Check whether the last element of the decimal expansion is a List
.
Length@#==1
If the above condition is True
, check whether the entire decimal expansion consists of one thing. (A List
counts as one entity). (returns True
or False
)
(If the condition is False
, then a Null
is returned because there is no third argument for If
)