OFFSET
0,2
LINKS
Arran Ireland, Table of n, a(n) for n = 0..304 (a(0) inserted by Georg Fischer, May 05 2019)
Arran Ireland, Python program (a(0) inserted by Georg Fischer, May 05 2019)
Reddit website, Integer sequence: Pairwise Combinatorial Digit Sum
FORMULA
Let d be the smallest divisor of n for which 9*d*(d+1) >= n; then a(n) is the smallest (d+1)-digit number whose digit sum is n/d. - Jon E. Schoenfield, Apr 15 2019
EXAMPLE
a(39) = 1039 as (1 + 0) + (1 + 3) + (1 + 9) + (0 + 3) + (0 + 9) + (3 + 9) = 39. The sums in brackets are pairs of digits of 1039. No positive integer less than 1039 has this pairwise digit sum. - David A. Corneth, Apr 16 2019
MATHEMATICA
fs[nd_, s_] := If[nd*9 < s, 0, Block[{n=10^(nd-1), f=0}, While[n < 10^nd, If[Total@ IntegerDigits@ n == s, f = n; Break[], n++]]; f]]; a[n_] := Block[{s}, Do[s = fs[d+1, n/d]; If[s > 0, Break[]], {d, Divisors[n]}]; s]; Join[{0}, Array[a, 50]] (* Giovanni Resta, Apr 15 2019 *)
PROG
(Magma) for n in [1..50] do for d in Divisors(n) do if n le 9*d*(d+1) then nd:=d+1; sdLeft:=n div d; S:=[]; for j in [1..nd-1] do if sdLeft gt 9 then S[j]:=9; else S[j]:=sdLeft-1; end if; sdLeft-:=S[j]; end for; S[nd]:=sdLeft; a:=Seqint(S); n, a; break; end if; end for; end for; // Jon E. Schoenfield, Apr 15 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Arran Ireland, Apr 14 2019
STATUS
approved