HP Forums

Full Version: (49G) OEIS A035327
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For integer input N > -1 the programme returns the Nth element in the sequence


Not a masterpiece but does use ←A.

  « DUP 2 <
    THEN 1 SWAP -
    ELSE 2 IDIV2
SWAP ←A EVAL 2 * 1
+ SWAP -
  » → ←A
  « ←A EVAL

Imptovements welcome.
Hi Gerald

Nice to see you posting sequences again. Thanks especially for posting a program using compiled local variables, which still make my head spin. Studying your program may help. Smile

While I certainly can't improve on your program, I do have one from a completely different angle, based on the structure of the sequence. Given an integer n, this program returns a list of the first 2^(n+1) terms. So for example, given the number 5 the program will return the first 64 terms.

This program also uses the ListExt command LSEQR.


\<< 1 { 1 0 } ROT 1 SWAP
Reference URL's