--- title: "The Answer to Life, the Universe, and Everything" id: 81093 type: "computer_media" slug: "the-answer-to-life-the-universe-and-everything" url: "http://localhost/computer_media/the-answer-to-life-the-universe-and-everything/" markdown_url: "http://localhost/computer_media/the-answer-to-life-the-universe-and-everything.md" published_at: "2026-11-26T23:47:35+00:00" modified_at: "2026-11-26T23:47:35+00:00" featured_image: url: "http://localhost/wp-content/uploads/2026/11/answer-to-life-1.png" excerpt: "Enter any age and the TS1000/ZX81 answers 42." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" model: - name: "Sinclair ZX81" slug: "zx81" taxonomy: "model" url: "http://localhost/model/zx81/" - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" indiv: - name: "Cliff Danielson" slug: "cliff-danielson" taxonomy: "indiv" url: "http://localhost/indiv/cliff-danielson/" genre: - name: "Demo" slug: "demo" taxonomy: "genre" url: "http://localhost/type/demo/" media_type: "Program" programmers: - name: "Cliff Danielson" slug: "cliff-danielson" taxonomy: "indiv" url: "http://localhost/indiv/cliff-danielson/" download_url: "https://archive.org/download/timex-sinclair-software-archive/The%20Answer%20to%20Life%2C%20the%20Universe%2C%20and%20Everything%20%281982%29%28Danielson%2C%20Cliff%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1982" images: - url: "http://localhost/wp-content/uploads/2026/11/answer-to-life-1.png" - url: "http://localhost/wp-content/uploads/2026/11/answer-to-life-2.png" article_media: - id: 22461 title: "The Answer to Life, the Universe, and Everything" type: "article" url: "http://localhost/article/the-answer-to-life-the-universe-and-everything/" media_type_tags: "Demo" license: false --- # The Answer to Life, the Universe, and Everything A joke program for the TS1000 or ZX81, after The Hitchhiker’s Guide to the Galaxy: enter your age and it gives “the answer to life, the universe, and everything”. The answer is 42. RUN it, enter an age (2 or more), then a friend’s age, and so on. The string A$ holds a formula with the tokens SQR, EXP, PI and **; VAL takes square roots of the age until it is close to 1, and the answer is two digits of EXP (-PI*I). An age of 1 gives 43, and an age below 1 stops the program. It runs in 1K. Corrected so it runs: line 60 as printed has one closing bracket too few, so the line cannot be entered (and stops with report C if loaded). One “)” is added after (6 TO 12). The article is unsigned; it is credited to the newsletter’s editor, Cliff Danielson. Published in the BCS Sinclair-Timex User Group Newsletter December 1982 ([The Answer to Life, the Universe, and Everything](https://timexsinclair.com/article/the-answer-to-life-the-universe-and-everything/)). ## Source Code ``` 1 LET A$="I-SQR I>EXP(-PI*I)/PI**2" 10 PRINT "ENTER YOUR AGE" 20 INPUT I 30 CLS 40 PRINT ,,,,"THE ANSWER TO LIFE, THE UNIVERSE, AND EVERYTHING IS "; 42 LET I=VAL A$ (3 TO 4) 50 IF VAL A$ THEN GOTO 42 60 PRINT (STR$ (VAL A$ (6 TO 12)))(3 TO 4) 70 PRINT "ENTER A FRIENDS AGE" 80 GOTO 20 ```