Skip to content

Instantly share code, notes, and snippets.

View loicnestler's full-sized avatar
🏠
Working from home

Loïc loicnestler

🏠
Working from home
View GitHub Profile
@loicnestler
loicnestler / calculation.rb
Created June 22, 2025 23:17 — forked from robbl/calculation.rb
fusion festival: probability to get fusion tickets by crew size
def next_row row
([0] + row).zip(row + [0]).collect do |l, r|
l + r
end
end
def pascal n
([nil] * n).inject([1]) do |row, y|
y = next_row row
end