A246878 a(0) = 1, then a(n) = sum(a(k), k = floor(log_2(n)) .. n - 1).
1, 1, 1, 2, 3, 6, 12, 24, 47, 94, 188, 376, 752, 1504, 3008, 6016, 12030, 24060, 48120, 96240, 192480, 384960, 769920, 1539840, 3079680, 6159360, 12318720, 24637440, 49274880, 98549760, 197099520, 394199040, 788398077
Offset: 0
Examples
a(2) = a(1) = a(0) = 1. a(3) = a(2) + a(1) = 2. a(4) = a(3) + a(2) = 3. a(5) = a(4) + a(3) + a(2) = 6.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..1000
- W. Kuszmaul, Fast Algorithms for Finding Pattern Avoiders and Counting Pattern Occurrences in Permutations, arXiv preprint arXiv:1509.08216, 2015
Crossrefs
Cf. A000523.
Programs
-
Haskell
import Data.List (genericDrop) a246878 n = a246878_list !! n a246878_list = 1 : f [1] a000523_list where f xs (k:ks) = y : f (xs ++ [y]) ks where y = sum $ genericDrop k xs -- Reinhard Zumkeller, Sep 16 2014
Formula
If n >= 1 is not a power of 2, then a(n) = 2*a(n - 1), and if k >= 1, then a(2^k) = 2*a(2^k - 1) - a(k - 1).
Comments