Get the latest tech news

Calculating the largest known prime in Ruby


Looking to impress your Ruby friends by calculating the largest known prime, 2 ** 136_279_841-1? On Ruby 3.4.0-preview2 and earlier, 2 ** 136_279_841-1 logs a warning and returns Infinity 😔: 2 ** 136_279_841-1 # warning: in a**b, b may be too big # => Infinity Thanks to @mametter, Ruby 3.4 will handle this calculation just fine! See Do not round a**b to infinity. Knowing this, you excitedly use your ruby manager of choice to pull down ruby master:

Looking to impress your Ruby friends by calculating the largest known prime, 2 ** 136_279_841-1? Without it, you can kiss your largest prime calculating dreams goodbye 👋. This was all inspired by Matz ’s keynote at RubyConf 2024 - where he mentioned that Ruby 3.4 can now calculate the largest known prime.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of ruby

ruby

Photo of largest known prime

largest known prime

Related news:

News photo

How we made a Ruby method 200x faster

News photo

Optimize Database Performance in Ruby on Rails and ActiveRecord

News photo

Understanding Ruby 3.3 Concurrency: A Comprehensive Guide