diff options
| author | Frank Oosterhuis <frank.oosterhuis@getthere.nl> | 2021-07-01 15:05:58 +0200 |
|---|---|---|
| committer | Frank Oosterhuis <frank.oosterhuis@getthere.nl> | 2021-07-01 15:05:58 +0200 |
| commit | bea3fdaad02054bc86e585baf38ee6a63a99553f (patch) | |
| tree | d8e02f88720a7c020ecc6c25ec1dfda6e68d7561 | |
| parent | 039206dc90cc538bc78500f9105a997389c0fcd3 (diff) | |
| download | perlweeklychallenge-club-bea3fdaad02054bc86e585baf38ee6a63a99553f.tar.gz perlweeklychallenge-club-bea3fdaad02054bc86e585baf38ee6a63a99553f.tar.bz2 perlweeklychallenge-club-bea3fdaad02054bc86e585baf38ee6a63a99553f.zip | |
Limitless Sequencer
| -rw-r--r-- | challenge-119/frankivo/scala/Sequencer.scala | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/challenge-119/frankivo/scala/Sequencer.scala b/challenge-119/frankivo/scala/Sequencer.scala index 7fac61b488..e0fb73d2cc 100644 --- a/challenge-119/frankivo/scala/Sequencer.scala +++ b/challenge-119/frankivo/scala/Sequencer.scala @@ -1,8 +1,13 @@ object Sequencer { def sequencer(n: Int): Int = { - ((1 to n * n.toString.length * 30) - .filterNot(_.toString exists (((4 to 9).toSeq :+ 0).map(_.toString) contains _.toString)) - .filterNot(_.toString contains "11") - ) (n - 1) + var i = 1 + var ok = 1 + while (ok < n) { + if (!i.toString.exists(((4 to 9).toSeq :+ 0).map(_.toString) contains _.toString)) + if (!i.toString.contains("11")) + ok = ok + 1 + i = i + 1 + } + i } }
\ No newline at end of file |
