A307153 Sequence gives pair of terms giving the numbers of previous even digits and previous odd digits; a(0)=0.
0, 1, 1, 1, 3, 1, 5, 1, 7, 1, 9, 1, 11, 1, 14, 2, 15, 3, 18, 4, 19, 5, 22, 7, 23, 8, 24, 11, 26, 13, 28, 15, 30, 16, 32, 18, 34, 20, 35, 22, 37, 24, 39, 26, 41, 29, 43, 31, 46, 33, 48, 35, 50, 36, 52, 38, 54, 40, 55, 42, 57, 44, 59, 46, 61, 49, 63, 51, 66, 53, 68
Offset: 0
Examples
a(1) = 1 because there is only one even digit before a(1): a(0) = 0. a(2) = 1 because there is only one odd digit before a(2): a(1) = 1. Etc.
Links
- Paolo P. Lava, Table of n, a(n) for n = 0..10000
Programs
-
Maple
P:=proc(q) local a,b,d,d1,k,n,p,p1; a:=[0]: p:=1; d:=0; for n from 2 to q do a:=[op(a),p]: b:=[op(convert(p,base,10))]: p1:=0: d1:=0: for k from 1 to nops(b) do if b[k] mod 2=0 then p1:=p1+1: else d1:=d1+1: fi; od; d:=d+d1: p:=p+p1: a:=[op(a),d]: b:=[op(convert(d,base,10))]: p1:=0: d1:=0: for k from 1 to nops(b) do if b[k] mod 2=0 then p1:=p1+1: else d1:=d1+1: fi; od; d:=d+d1: p:=p+p1: od; op(a); end: P(35);
-
PARI
nb = [0,0]; for (n=1, 71, print1 (v=nb[1+n%2]", "); apply(d -> nb[1+d%2]++, if (v, digits(v), [0]))) \\ Rémy Sigrist, May 04 2019
Formula
a(2n+1) = total number of even digits from a(0) to a(2n).
a(2n+2) = total number of odd digits from a(0) to a(2n+1).
Comments