Post Reply 
(33s) OEIS A2516: EARLIEST SEQUENCE WITH A(A(N)) = 2N
08-21-2022, 08:59 AM (This post was last modified: 08-21-2022 03:37 PM by C.Ret.)
Post: #9
RE: (33s): OEIS A2516 EARLIEST SEQUENCE WITH A(A(N)) = 2N
(07-31-2022 03:32 PM)Gerald H Wrote:  Nice to find members who question my use of English - the expression may have some meaning on 49G, as 77. and 77 are different entities on that calculator.
However, definitely not an innovative type of integer.

Thank you very much, I am not a native English speaker and I was afraid of missing something here such as a specific math's object or anything else. Your explanations are clear to me and I think that calling an integer store in the machine as any other real value a real integer makes sense.

I recently read the english version of the HP-35S User manual and I notice they speak about real functions as well. Perhaps is your habit to use real integer link to this ?


(07-31-2022 06:25 PM)John Keith Wrote:  Speaking of which, here is a program for any RPL calculator which returns a list of A002516. Given an integer n on the stack, the length of the list will be n + (1 if n is odd else 2).
[...]
The program is based on the third formula on the OEIS page. A list of 1000 terms takes about 4.5 seconds on my 50g in approximate mode.

I adapt your RPL code to my HP-28S, but I was a bit disappointed by the variable length of the list depending of the argument. As in your RPL code, I used the third formula from the OEIS page. But an HP-28S will not compete again a fast and powerful HP-50g, to compute the list of the first 1000 terms takes about a short minute!

Nevertheless, it doesn't take much more time to also plot or print all these values. Please note the use of flag #1 to alternate a(n) definition on odd k value.


A2516:
« → m « { m } 0 CON 1 SF
   1 m FOR k
      k
         DUP 2 MOD
         « k 2 + IF 1 FC?C THEN k 6 - + 1 SF END »
         « OVER k 2 / GET 2 * »
        IFTE
      PUT
   NEXT » »


Usage: Enter n and execute A2516 to get an array of this length n containing the first n values of the suite from a(1) up to a(n).

7 A2516 returns [ 3 6 2 12 7 4 10 ]

On the HP-28S, this code can with great ease be modified and/or enhanced to allow plotting and printing (here on an HP-82240A IR-printer):

   


I always wonder why HP-50g's users so rarely exploit the amazing plotting capabilities of this great RPL system?

Edited: A typo was in the code, I type an '*' where a '+' is needed in the code.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (33s): OEIS A2516 EARLIEST SEQUENCE WITH A(A(N)) = 2N - C.Ret - 08-21-2022 08:59 AM



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