Skip to main content
Commonmark migration
Source Link

#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)

#Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

#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)

Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

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)

deleted 4 characters in body
Source Link
JungHwan Min
  • 13.9k
  • 3
  • 23
  • 69

#Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

#Explanation

RealDigits

Find the decimal expansion of N. (repeated digits are surrounded by an extra head List {}).

`ListQ@Last@#`ListQ@Last@#

Check whether the last element of the decimal expansion is a List.

`Length@#==1`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)

#Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

#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)

#Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

#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)

Explanation
Source Link
JungHwan Min
  • 13.9k
  • 3
  • 23
  • 69

#Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

#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)

#Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

#Mathematica, 44 bytes

If[ListQ@Last@#,Length@#==1]&@@RealDigits@#&

Returns Null for Terminating, True for purely periodic, and False for eventually periodic.

#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)

Source Link
JungHwan Min
  • 13.9k
  • 3
  • 23
  • 69
Loading