OFFSET
2,1
COMMENTS
For n > 2, a(n) <= n-1 (and the sum of digits of a(n)^2 in base n equals a(n)).
The term a(10) = 9 belongs to A058369.
For any n > 1 and k >= 0:
- let d_n(k) be the digital sum of k in base n,
- we have d_n(1) = 1 and d_n(n-1) = d_n((n-1)^2),
- for any k such that 0 <= k <= n, we have d_n(k^2) - d_n(k) = d_n((n-k)^2) - d_n(n-k),
- for any even n > 2, d_n(n/2) != d_n((n/2)^2),
- hence, for any n > 2, either a(n) < n/2 or a(n) = n-1,
- and the scatterplot of the sequence (for n > 2) has only points in the region y < x/2 and on the line y = x-1.
Apparently (see colorized scatterplot in Links section):
- for any k > 0, a(2^k + 1) = 2^k,
- if n is odd and not of the form 2^k + 1, then a(n) <= (n-1)/2.
See also A292788 for a similar sequence involving cubes instead of squares.
LINKS
EXAMPLE
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.
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 *)
PROG
(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))))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Sep 23 2017
STATUS
approved