%I #21 Jan 22 2022 19:25:51
%S 13,16,19,28,18,27,23,29,31,34,38,44,46,47,55,56,62,65,64,73,35,80,
%T 109,127,52,70,112,118,121,127,136,181,97,108,117,130,144,153,88,144,
%U 153,160,139,152,153,154,161,173,176,178,181,184,187,189,189,198
%N Irregular triangle read by rows: The n-th row lists the "n-th power friends", numbers k such that digsum(digsum(k^n)^n) = k but digsum(k^n) is not k.
%C Two numbers x and y with x < y are said to be "n-th power friends" if digsum(x^n)=y and digsum(y^n)=x. This sequence lists both x and y; A350301 lists just the x's and A350302 lists just the y's.
%C The name "n-th power friends" comes from "The Man Who Counted", where the n=2 case is discussed:
%C "The digits of the number 256 add up to 13. The square of 13 is 169. The digits of 169 add up to 16. As a result, the numbers 13 and 16 have a curious relation, which we could call a quadratic friendship" (p. 33).
%C There are finitely many such k for a particular n since digsum(digsum(k^n)^n) <= 9n log_10(9n log_10(k)). There are no such k for n=1 since either k is a single digit or else digsum(k) < k.
%D M. Tahan, The Man Who Counted: A Collection of Mathematical Adventures, W. W. Norton & Company, 1993.
%e Triangle begins:
%e 13, 16;
%e 19, 28;
%e 18, 27;
%e 23, 29, 31, 34;
%e ;
%e 38, 44, 46, 47, 55, 56, 62, 65;
%e 64, 73;
%e 35, 80;
%e ;
%e ;
%e 109, 127;
%e 52, 70, 112, 118, 121, 127, 136, 181;
%e 97, 108, 117, 130;
%e 144, 153;
%e 88, 144, 153, 160;
%e ...
%e 18 and 27 are in row n=4 since 18^4 = 104976 and 1 + 0 + 4 + 9 + 7 + 6 = 27, and 27^4 = 531441 and 5 + 3 + 1 + 4 + 4 + 1 = 18.
%o (Python 3)
%o from math import log
%o n = 1
%o while n <= 50:
%o k = 2
%o while 9*n*log(9*n*log(k,10),10) >= k:
%o s1 = sum(int(d) for d in str(k**n))
%o s2 = sum(int(d) for d in str(s1**n))
%o if k != s1 and k == s2:
%o print(k)
%o k += 1
%o n += 1
%Y Cf. A007953, A350301, A350302.
%K nonn,base,tabf
%O 2,1
%A _Daniel Carter_, Dec 23 2021