A383356 a(n) = index of the smallest nonagonal number having the same digital sum as the n-th triangular number.
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
Examples
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.
Links
- Michel Lagneau, Table of n, a(n) for n = 1..10000
Programs
-
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
-
PARI
a(n) = my(s=sumdigits((n^2+n)/2)); k=1; while(sumdigits((7*k^2-5*k)/2)!=s, k++); k;
Comments