Skip to main content
added 338 characters in body
Source Link
Xwtek
  • 2k
  • 11
  • 28

Haskell, 57 bytes Invalid solution

import Data.List
(==[[]]).intersect<*>map(\a->a++a).tails

True for irrational number, False for rational number

I used a different algorithm for this program. This program returns true if the sequence ends with two identical sequence next to each other. For example, this program returns true for [1,2,3,4,3,4] because it ends with [3,4,3,4], which is [3,4] repeated twice.

For rational number, it's obvious that this will return false for large enough string, because rational number always ends with repeating string of digits. However, I don't know if this program still worksHowever, I don't know if this program still works for irrational number. Turns out it doesn't work for irrational number,numbers.

Haskell, 60 bytes

import Data.List
isInfixOf<$>(drop=<<(`div`2).length)<*>init

Turns out that the fixed solution is not that worse. This uses the more standard solution: whether the last half of the string still appears anywhere else in the string.

Haskell, 57 bytes Invalid solution

import Data.List
(==[[]]).intersect<*>map(\a->a++a).tails

True for irrational number, False for rational number

I used a different algorithm for this program. This program returns true if the sequence ends with two identical sequence next to each other. For example, this program returns true for [1,2,3,4,3,4] because it ends with [3,4,3,4], which is [3,4] repeated twice.

For rational number, it's obvious that this will return false for large enough string, because rational number always ends with repeating string of digits. However, I don't know if this program still works for irrational number,

Haskell, 57 bytes Invalid solution

import Data.List
(==[[]]).intersect<*>map(\a->a++a).tails

True for irrational number, False for rational number

I used a different algorithm for this program. This program returns true if the sequence ends with two identical sequence next to each other. For example, this program returns true for [1,2,3,4,3,4] because it ends with [3,4,3,4], which is [3,4] repeated twice.

For rational number, it's obvious that this will return false for large enough string, because rational number always ends with repeating string of digits. However, I don't know if this program still works for irrational number. Turns out it doesn't work for irrational numbers.

Haskell, 60 bytes

import Data.List
isInfixOf<$>(drop=<<(`div`2).length)<*>init

Turns out that the fixed solution is not that worse. This uses the more standard solution: whether the last half of the string still appears anywhere else in the string.

added 34 characters in body
Source Link
Xwtek
  • 2k
  • 11
  • 28

Haskell, 57 bytesHaskell, 57 bytes Invalid solution

import Data.List
(==[[]]).intersect<*>map(\a->a++a).tails

True for irrational number, False for rational number

I used a different algorithm for this program. This program returns true if the sequence ends with two identical sequence next to each other. For example, this program returns true for [1,2,3,4,3,4] because it ends with [3,4,3,4], which is [3,4] repeated twice.

For rational number, it's obvious that this will return false for large enough string, because rational number always ends with repeating string of digits. However, I don't know if this program still works for irrational number,

Haskell, 57 bytes

import Data.List
(==[[]]).intersect<*>map(\a->a++a).tails

True for irrational number, False for rational number

I used a different algorithm for this program. This program returns true if the sequence ends with two identical sequence next to each other. For example, this program returns true for [1,2,3,4,3,4] because it ends with [3,4,3,4], which is [3,4] repeated twice.

For rational number, it's obvious that this will return false for large enough string, because rational number always ends with repeating string of digits. However, I don't know if this program still works for irrational number,

Haskell, 57 bytes Invalid solution

import Data.List
(==[[]]).intersect<*>map(\a->a++a).tails

True for irrational number, False for rational number

I used a different algorithm for this program. This program returns true if the sequence ends with two identical sequence next to each other. For example, this program returns true for [1,2,3,4,3,4] because it ends with [3,4,3,4], which is [3,4] repeated twice.

For rational number, it's obvious that this will return false for large enough string, because rational number always ends with repeating string of digits. However, I don't know if this program still works for irrational number,

Source Link
Xwtek
  • 2k
  • 11
  • 28

Haskell, 57 bytes

import Data.List
(==[[]]).intersect<*>map(\a->a++a).tails

True for irrational number, False for rational number

I used a different algorithm for this program. This program returns true if the sequence ends with two identical sequence next to each other. For example, this program returns true for [1,2,3,4,3,4] because it ends with [3,4,3,4], which is [3,4] repeated twice.

For rational number, it's obvious that this will return false for large enough string, because rational number always ends with repeating string of digits. However, I don't know if this program still works for irrational number,