login
A383356
a(n) = index of the smallest nonagonal number having the same digital sum as the n-th triangular number.
1
1, 6, 3, 1, 3, 6, 4, 2, 2, 4, 5, 12, 4, 3, 6, 4, 2, 2, 4, 6, 3, 4, 12, 6, 4, 2, 11, 4, 5, 12, 13, 12, 5, 13, 2, 11, 4, 5, 12, 4, 12, 5, 13, 11, 2, 4, 5, 12, 4, 12, 5, 13, 2, 11, 4, 23, 12, 4, 12, 5, 13, 11, 2, 4, 5, 3, 13, 12, 5, 13, 11, 11, 4, 23, 12, 13, 3, 5, 4, 2, 2, 4
OFFSET
1,2
COMMENTS
From Robert Israel, Apr 24 2025: (Start)
If n == 0 or 8 (mod 9) then a(n) == 0 or 2 (mod 9).
If n == 1, 4 or 7 (mod 9) then a(n) == 1, 4 or 7 (mod 9).
If n == 2 or 6 (mod 9) then a(n) == 5 or 6 (mod 9).
If n == 3 or 5 (mod 9) then a(n) == 3 or 8 (mod 9). (End)
LINKS
EXAMPLE
For n = 2, the 2nd triangular number is (2^2+2)/2 = 3, its digital sum is 3 and the smallest nonagonal number having 3 as digital sum is (7*6^2 - 5*6)/2 = 111 whose index is 6, so a(2) = 6.
For n = 16, the 16-th triangular number is (16^2 +16)/2 = 136, its digital sum is 10 and the smallest nonagonal number having 10 as digital sum is (7*4^2 -5*4)/2 = 46 whose index is 4, so a(16) = 4.
MAPLE
ds:= n -> convert(convert(n, base, 10), `+`):
v:= 0: R:= NULL:
for k from 1 to 200 do
r:= ds(k*(k+1)/2);
if assigned(W[r]) then R:= R, W[r]
else do
v:= v+1;
s:= ds(v*(7*v-5)/2);
if not assigned(W[s]) then W[s]:= v fi;
if s = r then R:= R, v; break fi;
od fi od:
R; # Robert Israel, Apr 24 2025
PROG
(PARI) a(n) = my(s=sumdigits((n^2+n)/2)); k=1; while(sumdigits((7*k^2-5*k)/2)!=s, k++); k;
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
STATUS
approved