<commit_before>package pep_055

object Wip {

  val MaxIterations = 50

  def isLychrel(n: Int): Boolean = true // TODO

  def solve(max: Int = 10000) = 0 until max count isLychrel

}<commit_msg>pep_055 wip<commit_after>package pep_055

import pep_050.Memo
import scala.collection.mutable

object Wip {

  val MaxIterations = 50
//  val lychrelNumbers = mutable.Map.empty[Long, Boolean]
//  def check(x: Long) = lychrelNumbers getOrElseUpdate(x, f(x))
//  def add(x: Long) = lychrelNumbers getOrElseUpdate(x, f(x))

  def isLychrel(n: Int): Boolean = {
    var acc: Long = n
    for (i <- 1 to MaxIterations; if !isPalindrome(acc)) acc += digitReverse(acc)
    isPalindrome(acc)
  }

  def digitReverse(n: Long) = n.toString.toSeq.reverse.mkString.toInt

  def isPalindrome(n: Long): Boolean = {
    val ns = n.toString.toSeq
    ns == ns.reverse
  }

  //  lazy val aaa: Memo[(Long, Int), Boolean] = Memo {
  //    case (n, MaxIterations) => // isPalindrome(n)
  //    case (n, i) => // TODO
  //  }

  def solve(max: Int = 10000) = 0 until max count isLychrel

}
{'fraction_non_alphanumeric': 0.1325187969924812, 'fraction_numerical': 0.02725563909774436, 'mean_word_length': 3.2261904761904763, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7352938', 'n_tokens_mistral': 441, 'n_tokens_neox': 399, 'n_words': 105}