TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Pick a Number Between 1 and 99

3 pointsby garycomtoisalmost 10 years ago

1 comment

eLodalmost 10 years ago
out of curiousity:<p><pre><code> require &#x27;numbers_and_words&#x27; 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 &quot;#{locale}: #{eliminate(locale).join &#x27;, &#x27;}\n&quot; end </code></pre> results:<p><pre><code> 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 </code></pre> so if i&#x27;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