login
Numbers k such that k equals {alternating sum of digits of k} raised to the power of {number of digits of k}.
1

%I #12 Jun 11 2022 13:51:12

%S 1,2,3,4,5,6,7,8,9,31381059609,1853020188851841

%N Numbers k such that k equals {alternating sum of digits of k} raised to the power of {number of digits of k}.

%C These are the only terms of this sequence.

%e 31381059609 = (9-0+6-9+5-0+1-8+3-1+3)^11.

%o (Python)

%o def A(n):

%o counter = 0

%o S = 0

%o q = n

%o while q:

%o q, c = q//10, q % 10

%o S += (-1)** counter * c

%o counter += 1

%o return S ** counter

%o def fixed_points_of_A():

%o for i in range(1,100):

%o m = int(10 ** (1 - 1/ i)) +1

%o for k in range(m, 10):

%o n = k**i

%o e = A(n)

%o if n ==e: print(n, k, i) #prints n, the value of the alternating sum, and of the power to which is raised this number.

%Y Fixed points of A353906.

%Y Cf. A055017 (alternating sum starting from the last digit of n).

%Y Cf. A055642 (number of digits of n).

%K nonn,easy,base,fini,full

%O 1,2

%A _Malo David_, May 10 2022