cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Sep 23 2017

Keywords

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.

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.
		

Crossrefs

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))))