A340574 a(1) = 112. a(n) is the smallest number k with the sum of the even digits equal to the sum of the odd digits (A036301), which is not an earlier term, for which k*a(n - 1) has the sum of the even digits equal to the sum of the odd digits (A036301).
112, 583, 1120, 781, 1452, 615, 1627, 1694, 1506, 1403, 1078, 1043, 538, 121, 4983, 1087, 1708, 1304, 314, 385, 341, 134, 187, 1340, 718, 2123, 358, 1021, 1102, 211, 835, 2110, 1322, 3265, 2558, 561, 1034, 871, 2167, 3085, 1232, 1245, 413, 2716, 1201, 1012, 336
Offset: 1
Examples
a(1) = 112, a(2) = 583 = A036301(22) and a(1)*a(2) = 112*583 = 65296 is a term in A036301 because 6 + 2 + 6 = 14 = 5 + 9. a(2) = 583, a(3) = 1120 = A036301(41) and a(2)*a(3) = 583*1120 = 652960 is a term in A036301 because 6 + 2 + 6 + 0 = 14 = 5 + 9.
Programs
-
Magma
f:=func
; a:=[112]; for n in [2..50] do k:=1; while k in a or not f(k) or not f(k*a[n-1]) do k:=k+1; end while; Append(~a,k); end for; a; -
PARI
isokd(n) = my(d=digits(n)); sum(k=1, #d, d[k]*(d[k] % 2)) == sum(k=1, #d, d[k]*(1-d[k]%2)); \\ A036301 nextk(va, n) = {my(ok = 0, k = 1); while (! (isokd(k) && isokd(k*va[n-1]) && !#select(x->(x==k), va)), k++); k;} lista(nn) = {my(va = vector(nn)); va[1] = 112; for (n=2, nn, my(k = nextk(va, n)); va[n] = k;); va;} \\ Michel Marcus, Jan 14 2021
Comments