A337854 a(n) is the smallest number that can be partitioned in exactly n ways as the sum of two Niven numbers.
0, 2, 4, 6, 8, 10, 51, 48, 72, 108, 126, 90, 138, 144, 120, 198, 162, 210, 216, 315, 240, 234, 306, 252, 372, 270, 546, 360, 342, 444, 414, 468, 420, 642, 450, 522, 540, 924, 612, 600, 666, 630, 888, 930, 756, 840, 882, 936, 972, 1098, 1215, 1026, 1212, 1080
Offset: 0
Examples
a(0) = 0 because 0 cannot be written as the sum of two Niven numbers. a(1) = 2 because 2 is uniquely written 2 = 1 + 1, with 1 in A005349. a(2) = 4 because 4 = 1 + 3 = 2 + 2 and 1, 2, 3 are in A005349. a(3) = 6 because 6 = 1 + 5 = 2 + 4 = 3 + 3 and 1, 2, 3, 4, 5 are terms in A005349. a(6) = 51, because 51 = 1 + 50 = 3 + 48 = 6 + 45 = 9 + 42 = 21 + 30 = 24 + 27 and 1, 3, 6, 9, 21, 24, 27, 30, 42, 45, 48, 50 are terms in A005349.
Programs
-
Magma
a:=[]; niven:=func
; for n in [0..55] do k:=0; while k le 10000 and #RestrictedPartitions(k,2,{m:m in [1..k-1]| niven(m)}) ne n do k:=k+1; end while; Append(~a,k); end for; a; -
Mathematica
m = 1300; nivens = Select[Range[m], Divisible[#, Plus @@ IntegerDigits[#]] &]; a[n_] := Length[IntegerPartitions[n, {2}, nivens]]; mx = 54; s = Table[-1, {mx}]; c = 0; n = 0; While[c < mx, i = a[n] + 1; If[i <= mx && s[[i]] < 0, c++; s[[i]] = n]; n++]; s (* Amiram Eldar, Sep 27 2020 *)