cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A004065 Define predecessors of n, P(n), to consist of numbers whose binary representation is obtained from that of n by replacing 10 with 01 or changing a final 1 to a 0; then a(0)=1, a(n) = Sum a(P(n)), n>0.

This page as a plain text file.
%I A004065 #28 Aug 28 2024 09:37:31
%S A004065 1,1,1,1,1,2,2,2,1,3,5,7,5,12,12,12,1,4,9,16,14,42,54,66,14,56,110,
%T A004065 176,110,286,286,286,1,5,14,30,28,100,154,220,42,198,462,858,572,1716,
%U A004065 2002,2288,42,240,702,1560,1274,4550,6552,8840,1274,5824,12376
%N A004065 Define predecessors of n, P(n), to consist of numbers whose binary representation is obtained from that of n by replacing 10 with 01 or changing a final 1 to a 0; then a(0)=1, a(n) = Sum a(P(n)), n>0.
%H A004065 Alois P. Heinz, <a href="/A004065/b004065.txt">Table of n, a(n) for n = 0..8191</a>
%F A004065 a(2^n-1) = A003121(n).
%e A004065 E.g. 201 = 11001001, so P(201) = {169, 197, 200}, a(201) = a(169) + a(197) + a(200).
%p A004065 P:= proc(n) local h, i, m, s, t;
%p A004065       t:= irem(n, 2, 'm');
%p A004065       s:= `if`(t=1, {n-1}, {});
%p A004065       for i from 0 while m>0 do h:= irem(m, 2, 'm');
%p A004065         if h=1 and t=0 then s:= s union {n- 2^i} fi; t:=h
%p A004065       od; s
%p A004065     end:
%p A004065 a:= proc(n) a(n):= `if`(n=0, 1, add(a(k), k=P(n))) end:
%p A004065 seq (a(n), n=0..80);  # _Alois P. Heinz_, Jul 06 2012
%t A004065 P[n_] := Module[{h, i, m, s, t}, {m, t} = QuotientRemainder[n, 2]; s = If[t == 1, {n-1}, {}]; For[i = 0, m>0, i++, {m, h} = QuotientRemainder[m, 2]; If[h == 1 && t == 0, s = s ~Union~ {n-2^i}]; t = h]; s]; a[n_] := a[n] = If[n == 0, 1, Sum[a[k], {k, P[n]}]]; Table[a[n], {n, 0, 80}] (* _Jean-François Alcover_, Jun 11 2015, after _Alois P. Heinz_ *)
%Y A004065 Cf. A003121.
%K A004065 nonn,base
%O A004065 0,6
%A A004065 _David W. Wilson_, Jan 29 2000
%E A004065 Entry revised by _N. J. A. Sloane_, Jun 14 2012