Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Output the simplified Goodstein sequence

Python 2, 77 74 bytes

-3 bytes thanks to Lynn

n=input();b=1
while n:print"+".join(n/b*[`b`]+[`n%b`][:n%b]);n+=n/b-1;b+=1

Try it online!

Easily runs up to n = 100 (though the output is too long for tio fully show).


Pyth, 29 bytes

WQ=hZj\++*]Z/QZ<]J%QZJ=+Qt/QZ

Try it here!


Mathematica, 123 bytes

(s=1~Table~#;i=1;While[s!={},[email protected][ToString/@s,"+"];s=s/.i->i+1;s=Join[[email protected],{[email protected]}-1]~DeleteCases~0;i++])&


Try it online!

Tags:

Math

Sequence

Code Golf

Related

Square pyramidal numbers How can I shorten this python code? I am greater than you! 26 Singers, 26 Letters Given an int input n, print out n*reversed(n) A train crosses a labeled bridge Writing rational numbers as ratio of factorials of primes An expanding array I don't like change! Elliptic system Back to the Basics of Math Numbers with similar powers

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy