Post Reply 
Prime Number Search
07-20-2024, 12:31 PM
Post: #6
RE: Prime Number Search
This is all very interesting, it deserves to be expanded into an article if you feel like doing so. I am particularly interested in seeing the HP 50 programs that you mention.

(07-19-2024 11:57 PM)ttw Wrote:  One generates Stern's Diatomic Series using the two-term recursion: S(n+1)=S(n)+S(n-1)-2*(S(n-1) mod S(n)).

The recurrence in the OEIS page, a(2*n) = a(n), a(2*n+1) = a(n) + a(n+1) is faster to compute because it doesn't require MOD. Here is a program implementing the recurrence. It will run on any RPL calculator, returning the first 2n+1 terms of the sequence.

Code:

\<< \-> n
  \<< 0 1 1 2 n
    FOR k k PICK k PICK DUP ROT + SWAP
    NEXT n 2 * 1 + \->LIST
  \>>
\>>
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Prime Number Search - SlideRule - 07-19-2024, 01:40 PM
RE: Prime Number Search - Allen - 07-19-2024, 08:36 PM
RE: Prime Number Search - SlideRule - 07-19-2024, 10:12 PM
RE: Prime Number Search - ttw - 07-19-2024, 11:57 PM
RE: Prime Number Search - John Keith - 07-20-2024 12:31 PM
RE: Prime Number Search - ttw - 07-21-2024, 02:52 AM



User(s) browsing this thread: 1 Guest(s)