HP Forums
(33s): OEIS A1614, Connell sequence, & A122793, A171152, A118011 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (33s): OEIS A1614, Connell sequence, & A122793, A171152, A118011 (/thread-18596.html)



(33s): OEIS A1614, Connell sequence, & A122793, A171152, A118011 - Gerald H - 07-28-2022 11:34 AM

Takes a real integer from the stack & returns A118011(N)
https://oeis.org/A118011
, A171152(N)
https://oeis.org/A171152
,A122793(N)
https://oeis.org/A122793
& A1614(N)
https://oeis.org/A001614
to stack.
Nth member of complement of Connell sequence & partial sum, Nth of Connell sequence & partial sum of series.

eg For input

2022

The programme returns

T: 4,108 Complement of Connell sequence, 2022nd number not in Connell sequence

Z: 4,176,234 Sum of first 2022 members of Complement sequence

Y: 3,980 2022nd member of Connell sequence

X: 4,004,778 Sum of first 2022 members of Connell sequence

Code:
1.    LBL M
2.    STO N
3.    IP(SQRT(2)*SQRT(N)+0.5)
4.    STO E
5.    E*(N+(1-SQ(E))/6)
6.    STO F
7.    N+SQ(N)
8.    STO G
9.    2*N+E
10.    G+F
11.    2*N-E
12.    G-F
13.    RTN

M: LN = 102



RE: (33s): OEIS A1614, Connell sequence, & A122793, A171152, A118011 - John Keith - 07-28-2022 07:52 PM

That is an impressively small program, especially considering that it returns all 4 values. But then I noticed your name on the formulas on the OEIS pages. Smile

Here is a program for the HP 49 and 50 using ListExt 1.3 which works in a completely different way. Given a number n on the stack, the program returns a list of the first n*(n+1)/2 terms of the Connell sequence A001614. With an input of 50, the program returns a list of 1275 numbers in about 2.1 seconds on my 50g.

Code:

\<< LSEQ
  { DUP 1 - SQ 1 + 2 ROT LASEQ
  } LMAP LXIL
\>>

For the partial sums A122793, follow the program with { + } LSCAN.