login
A339714
Numbers with equal number of even and odd digits such that the sum a(n) + a(n+1) has an equal number of even and odd digits too.
1
10, 1090, 12, 18, 14, 16, 25, 27, 23, 29, 21, 49, 32, 38, 34, 36, 45, 47, 43, 1007, 54, 1009, 41, 1029, 52, 1018, 56, 1005, 58, 1003, 67, 1014, 69, 1001, 89, 1120, 81, 1021, 83, 1023, 85, 1041, 61, 1043, 63, 1027, 65, 1016, 74, 1030, 70, 1032, 72, 1034, 90, 1010, 92, 1012, 78, 1050, 50, 1052, 76, 1070, 30
OFFSET
1,1
COMMENTS
Lexicographically earliest sequence of distinct positive terms with this property.
Numbers with an odd digit length cannot be in this sequence.
EXAMPLE
a(1) + a(2) = 10 + 1090 = 1100 (which has an equal number of even and odd digits);
a(2) + a(3) = 1090 + 12 = 1102 (idem);
a(3) + a(4) = 12 + 18 = 30 (idem);
a(4) + a(5) = 18 + 14 = 32 (idem); etc.
PROG
(Python)
def cond(i):
stri = str(i)
se = sum(1 for d in stri if d in "02468")
so = sum(1 for d in stri if d in "13579")
return se == so
def aupto(nn):
alst, used = [0], set()
for n in range(1, nn+1):
an = 10
while True:
while an in used: an += 1
if cond(an) and cond(an + alst[-1]):
alst.append(an); used.add(an); break
an += 1
return alst[1:] # use alst[n] for a(n)
print(aupto(56)) # Michael S. Branicky, Dec 14 2020
CROSSREFS
Cf. A339715 (same idea, replacing addition by multiplication), A227870 (numbers with equal number of even and odd digits).
Sequence in context: A226553 A054609 A119045 * A069886 A133383 A268229
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Dec 14 2020
STATUS
approved