login
Numbers with equal number of even and odd digits such that the product a(n) * a(n+1) has an equal number of even and odd digits too.
1

%I #9 Dec 18 2020 04:17:46

%S 12,92,16,67,21,49,25,41,30,38,29,43,36,47,23,61,18,72,27,54,32,58,52,

%T 34,50,65,45,63,56,70,74,14,78,69,85,90,81,76,94,87,83,96,1047,9562,

%U 89,1128,98,1036,9667,1041,9618,1058,9461,1061,9432,1074,9340,1083,9243,1087,9205,1090,9203,1100,9201

%N Numbers with equal number of even and odd digits such that the product a(n) * a(n+1) has an equal number of even and odd digits too.

%C Lexicographically earliest sequence of distinct positive terms with this property.

%C Numbers with an odd digit length cannot be in this sequence.

%e a(1) * a(2) = 12 * 92 = 1104 (which has an equal number of even and odd digits);

%e a(2) * a(3) = 92 * 16 = 1472 (idem);

%e a(3) * a(4) = 16 * 67 = 1072 (idem);

%e a(4) * a(5) = 67 * 21 = 1407 (idem); etc.

%o (Python)

%o def cond(i):

%o stri = str(i)

%o se = sum(1 for d in stri if d in "02468")

%o so = sum(1 for d in stri if d in "13579")

%o return se == so

%o def aupto(nn):

%o alst, used = [1], set()

%o for n in range(1, nn+1):

%o an = 12

%o while True:

%o while an in used: an += 1

%o if cond(an) and cond(an * alst[-1]):

%o alst.append(an); used.add(an); break

%o an += 1

%o return alst[1:] # use alst[n] for a(n)

%o print(aupto(59)) # _Michael S. Branicky_, Dec 14 2020

%Y Cf. A339714 (same idea, replacing multiplication by addition), A227870 (numbers with equal number of even and odd digits).

%K base,nonn

%O 1,1

%A _Eric Angelini_ and _Carole Dubois_, Dec 14 2020