Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Pick a Number Between 1 and 99 (matthen.com)
3 points by garycomtois on July 12, 2015 | hide | past | favorite | 1 comment


out of curiousity:

  require 'numbers_and_words'

  def convert(locale, numbers)
    I18n.with_locale locale do
      numbers.map { |i| i.to_words.length }
    end
  end

  def eliminate(locale, numbers = (1..99).to_a)
    eliminated = convert(locale, numbers).uniq
    if (numbers - eliminated).empty?
      eliminated
    else
      eliminate(locale, eliminated)
    end
  end

  %i[en es ru fr ua hu lt lv et tr de it nl se].each do |locale|
    print "#{locale}: #{eliminate(locale).join ', '}\n"
  end
results:

  en: 4
  es: 4, 6, 5
  ru: 6, 3, 5, 4, 11
  fr: 3, 5, 4, 6
  ua: 5, 3
  hu: 5, 2, 4
  lt: 4, 2, 6, 5, 7
  lv: 5, 7, 11
  et: 4
  tr: 2, 3, 4
  de: 4
  it: 3
  nl: 4
  se: 3, 4
so if i'm not mistaken 4 is four letters long on most of these languages, but you can see there are some other destinations on other languages




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: