Upgrade to Pro — share decks privately, control downloads, hide ads and more …

【2018/05/08 Otemachi.rb#6】Rubyで取り組むProject Eular

【2018/05/08 Otemachi.rb#6】Rubyで取り組むProject Eular

2018/05/08 Otemachi.rb#6でのLTです

Shu OGAWARA

May 08, 2018
Tweet

More Decks by Shu OGAWARA

Other Decks in Technology

Transcript

  1. 2018/05/08
    Otemachi.rb#6
    RubyProject Eular
    Shu OGAWARA
    (@expajp)

    View full-size slide

  2. +-$
    n ( '(@expajp)
    – 3
    – Ruby/Rails*1


    &%
    – #)!"
    – .%,

    View full-size slide

  3. Project Eular

    View full-size slide

  4. Project Eular
    https://projecteuler.net/

    View full-size slide

  5. Project EularRuby
    n 1978/-6:
    – 78/2,6+1.8000+
    n %'
    – ('$8;<
    – 45#/% &#&'7


    – Write Code Everyday "
    – )*&!603

    View full-size slide


  6. n Project Eular

    n
    – Ruby

    View full-size slide


  7. n Project EularRuby,$'
    "#!&

    – 30/.0
    -
    – 1
    n (+Project Eular)* %1),

    View full-size slide



  8. n
    – String#each_char
    • 1

    – Enumerable#inject

    View full-size slide



  9. n 100% ( #
    – Enumerable#combination(n)
    • &)
    n' (
    "
    – Prime.instance.prime? (prime$)
    • (
    !

    View full-size slide


  10. n Problem 4 !"
    $%
    & #!
    . 2'"!
    ,
    9009 = 91 99 .
    , 3'"!# .

    View full-size slide


  11. n Project Eular*)$ /F+"-
    n Ruby,-(!3.
    – Enumerable&'*:
    – ,-(!; ? 48

    – RubyA5=2796
    • E<% DC
    n Rails#BG@0>1

    View full-size slide