Extend New Binary Sequence ?

Max Alekseyev maxale at gmail.com
Sat Sep 1 03:24:24 CEST 2007


It is better first precompute and store values of A000123 using
dynamic programming and then computation of your sequence become
trivial:

? N= (2^(26+1) + (-1)^26 - 3)/6
? a123=vector(N)
? a123[1]=2; for(n=2,N,a123[n]=a123[n\2]+a123[n-1])
? a(n) = if(n==0,1, if(n==1,1, a123[ (2^(n+1) + (-1)^n - 3)/6 ] ))
? vector(26,n,a(n))

The result is:

[1, 2, 4, 14, 60, 450, 4964, 95982, 3037948, 170005730, 16522010532,
2882717916878, 902450057292988, 514768747418386946,
537142988843543963620, 1033976171696917695108270,
3688322935382700002945333884, 24514290054855626308893309022498,
304801526292655801235227790576374820,
7118057806591130565341301223201553053838,
313259388933361321062892077969687559682278460,
26062000616057795214066097831489188710729238725186,
4110314988488084452256619909138315265238808174186210404,
1232011347867422753097623155438444291235913527367600775244398,
703443704442715976354754937644920300954525944513753257422978632188,
766728692007699092343031760182847052574421909903729669942757487137772898]

Regards,
Max

On 8/31/07, Paul D. Hanna <pauldhanna at juno.com> wrote:
>
>
> Seqfans,
>       To start with the correct offset (=0), the PARI program
> should have been:
>
> A000123(n) = if(n<1, n==0, A000123(n\2) + A000123(n-1))
>
>
> a(n) = if(n==0,1, A000123( (2^(n+1) + (-1)^n - 3)/6 ) )
>
> I do not know if there is any faster way of programming this ...
> Perhaps I will find a matrix approach that will be quick?
>
> Thanks for any tips or tries in extending this sequence.
>     Paul
>
> On Fri, 31 Aug 2007 19:48:11 -0400 Paul D. Hanna <pauldhanna at juno.com>
> writes:
>
>
> The sequence begins:
>
> 1,1,2,4,14,60,450,4964,95982,3037948,
>
> but I can get no further before my old PARI gets "deep recursion".
>
>
> This is an equivalent definition using PARI:
>
> a(n) = if(n==0,1, A000123( (2^(n+2) - (-1)^n - 3)/6 ) )
>
> where
> A000123(n) = if(n<1, n==0, A000123(n\2) + A000123(n-1))
>





More information about the SeqFan mailing list