Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Fibonacci triangle

Given an integer n, output the following ASCII art to n rows:

1+たす1=2
 1+たす2=3
 2+たす3=5
 3+たす5=8
 5+たす8=13

Essentially, the first row is 1+1=2 and the nth row (1-indexed) is \$f_n + f_{n+1} = f_{n+2}\$ where \$f\$ is the Fibonacci sequence, padded so the numbers line up with the previous row.

You may instead output it infinitely. You may output a list of lines.

This is , shortest wins!

Testcase

The output for 20 should be:

1+たす1=2
 1+たす2=3
 2+たす3=5
 3+たす5=8
 5+たす8=13
 8+たす13=21
 13+たす21=34
 21+たす34=55
 34+たす55=89
 55+たす89=144
 89+たす144=233
 144+たす233=377
 233+たす377=610
 377+たす610=987
 610+たす987=1597
 987+たす1597=2584
 1597+たす2584=4181
 2584+たす4181=6765
 4181+たす6765=10946
 6765+たす10946=17711

Answer*

Draft saved
Draft discarded
Cancel
1
  • \$\begingroup\$ 66 bytes using %n: Try it online! \$\endgroup\$ Commented Mar 8, 2022 at 11:47

AltStyle によって変換されたページ (->オリジナル) /