login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A239447 Partial sums of A030101. 1

%I #17 Jan 10 2023 16:47:41

%S 0,1,2,5,6,11,14,21,22,31,36,49,52,63,70,85,86,103,112,137,142,163,

%T 176,205,208,227,238,265,272,295,310,341,342,375,392,441,450,491,516,

%U 573,578,615,636,689,702,747,776,837,840,875,894,945,956,999,1026,1085

%N Partial sums of A030101.

%H Alois P. Heinz, <a href="/A239447/b239447.txt">Table of n, a(n) for n = 0..10000</a>

%H Project Euler, <a href="https://projecteuler.net/problem=463">Problem 463: A weird recurrence relation</a>

%F a(4n) = 6 a(2n) - 5 a(n) - 3 a(n-1) - 1.

%F a(4n + 1) = 2 a(2n+1) + 4 a(2n) - 6 a(n) - 2 a(n-1) - 1.

%F a(4n + 2) = 3 a(2n+1) + 3 a(2n) - 6 a(n) - 2 a(n-1) - 1.

%F a(4n + 3) = 6 a(2n+1) - 8 a(n) - 1.

%t Accumulate[Table[FromDigits[Reverse[IntegerDigits[n,2]],2],{n,0,80}]] (* _Harvey P. Dale_, Jan 10 2023 *)

%o (Python) A = {0: 0, 1: 1, 2: 2, 3: 5}

%o .

%o def a(n):

%o ....a_n = A.get(n)

%o ....if a_n is not None:

%o ........return a_n

%o .

%o ....q, r = divmod(n, 4)

%o ....if r == 0:

%o ........a_n = a(q*2)*6 - a(q)*5 - a(q - 1)*3 - 1

%o ....elif r == 1:

%o ........a_n = a(q*2 + 1)*2 + a(q*2)*4 - a(q)*6 - a(q - 1)*2 - 1

%o ....elif r == 2:

%o ........a_n = a(q*2 + 1)*3 + a(q*2)*3 - a(q)*6 - a(q - 1)*2 - 1

%o ....else:

%o ........a_n = a(q*2 + 1)*6 - a(q)*8 - 1

%o .

%o ....A[n] = a_n # memoization

%o .

%o ....return a_n

%Y Cf. A030101.

%K nonn

%O 0,3

%A _Olivier Pirson_, Mar 18 2014

%E More terms from _Alois P. Heinz_, May 19 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 09:56 EDT 2024. Contains 371967 sequences. (Running on oeis4.)