# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a292787
Showing 1-1 of 1
%I A292787 #15 Sep 25 2017 15:16:36
%S A292787 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,
%T A292787 6,31,32,12,17,15,9,37,19,13,16,41,7,43,12,10,23,47,16,49,25,18,13,53,
%U A292787 27,11,8,19,29,59,16,61,31,28,64,26,12,67,17,24,15,71
%N 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.
%C A292787 For n > 2, a(n) <= n-1 (and the sum of digits of a(n)^2 in base n equals a(n)).
%C A292787 The term a(10) = 9 belongs to A058369.
%C A292787 For any n > 1 and k >= 0:
%C A292787 - let d_n(k) be the digital sum of k in base n,
%C A292787 - we have d_n(1) = 1 and d_n(n-1) = d_n((n-1)^2),
%C A292787 - 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),
%C A292787 - for any even n > 2, d_n(n/2) != d_n((n/2)^2),
%C A292787 - hence, for any n > 2, either a(n) < n/2 or a(n) = n-1,
%C A292787 - 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.
%C A292787 Apparently (see colorized scatterplot in Links section):
%C A292787 - for any k > 0, a(2^k + 1) = 2^k,
%C A292787 - if n is odd and not of the form 2^k + 1, then a(n) <= (n-1)/2.
%C A292787 See also A292788 for a similar sequence involving cubes instead of squares.
%H A292787 Rémy Sigrist, Scatterplot of the sequence for n=2..10000
%H A292787 Rémy Sigrist, Colorized scatterplot of the sequence for n=2..10000
%e A292787 For n = 8:
%e A292787 - 1 is a power of 8,
%e A292787 - d_8(2) = 2 and d_8(2^2) = 4,
%e A292787 - d_8(3) = 3 and d_8(3^2) = 2,
%e A292787 - d_8(4) = 4 and d_8(4^2) = 2,
%e A292787 - d_8(5) = 5 and d_8(5^2) = 4,
%e A292787 - d_8(6) = 6 and d_8(6^2) = 8,
%e A292787 - d_8(7) = 7 and d_8(7^2) = 7,
%e A292787 - hence a(8) = 7.
%t A292787 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 *)
%o A292787 (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))))
%Y A292787 Cf. A058369, A292788.
%K A292787 nonn,base
%O A292787 2,1
%A A292787 _Rémy Sigrist_, Sep 23 2017
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE