A292787 For n > 1, a(n) = least positive k, not a power of n, such that the digital sum of k in base n equals the digital sum of k^2 in base n.
3, 2, 3, 4, 5, 3, 7, 8, 9, 5, 11, 4, 13, 7, 6, 16, 17, 9, 19, 5, 7, 11, 23, 9, 25, 13, 27, 8, 29, 6, 31, 32, 12, 17, 15, 9, 37, 19, 13, 16, 41, 7, 43, 12, 10, 23, 47, 16, 49, 25, 18, 13, 53, 27, 11, 8, 19, 29, 59, 16, 61, 31, 28, 64, 26, 12, 67, 17, 24, 15, 71
Offset: 2
Examples
For n = 8: - 1 is a power of 8, - d_8(2) = 2 and d_8(2^2) = 4, - d_8(3) = 3 and d_8(3^2) = 2, - d_8(4) = 4 and d_8(4^2) = 2, - d_8(5) = 5 and d_8(5^2) = 4, - d_8(6) = 6 and d_8(6^2) = 8, - d_8(7) = 7 and d_8(7^2) = 7, - hence a(8) = 7.
Links
- Rémy Sigrist, Scatterplot of the sequence for n=2..10000
- Rémy Sigrist, Colorized scatterplot of the sequence for n=2..10000
Programs
-
Mathematica
With[{kk = 10^3}, Table[SelectFirst[Complement[Range[2, kk], n^Range@ Floor@ Log[n, kk]], Total@ IntegerDigits[#, n] == Total@ IntegerDigits[#^2, n] &] /. k_ /; MissingQ@ k -> -1, {n, 2, 72}]] (* Michael De Vlieger, Sep 24 2017 *)
-
PARI
a(n) = my (p=1); for (k=1, oo, if (k==p, p*=n, if (sumdigits(k,n) == sumdigits(k^2,n), return (k))))
Comments