login
Numbers k such that k equals the sum of its digits raised to the consecutive powers (1,2,3,...).
11

%I #71 Oct 31 2024 01:30:01

%S 0,1,2,3,4,5,6,7,8,9,89,135,175,518,598,1306,1676,2427,2646798,

%T 12157692622039623539

%N Numbers k such that k equals the sum of its digits raised to the consecutive powers (1,2,3,...).

%C Lemma: The sequence is finite with all terms in the sequence having at most 22 digits. Proof: Let n be an m-digit natural number in the sequence for some m. Then 10^(m-1)<=n and n<=9+9^2+...9^m = 9(9^m-1)/8<(9^(m+1))/8. Thus 10^(m-1)<(9^(m+1))/8. Taking logarithms of both sides and solving yields m<22.97 QED. Note proof is identical to that for A208130. [_Francis J. McDonnell_, Apr 14 2012]

%C Sometimes referred to as disarium numbers. - _Dumitru Damian_, Jul 22 2024

%D J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 175, p. 55, Ellipses, Paris 2008.

%D Ken Follett, Code to Zero, Dutton, a Penguin Group, NY 2000, p. 84.

%D D. Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, London, 1986, Entry 175.

%H Rosetta Code, <a href="https://rosettacode.org/wiki/Disarium_numbers">Disarium numbers</a>.

%H Tim Cross, <a href="https://www.jstor.org/stable/3621604">Problem 2002.1</a>, Student Problems, The Mathematical Gazette, Vol. 86, No. 505 (2002), p. 152.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/NarcissisticNumber.html">Narcissistic Number</a>.

%e 89 = 8^1 + 9^2.

%e 175 = 1^1 + 7^2 + 5^3.

%e 2427 = 2^1 + 4^2 + 2^3 + 7^4.

%e 2646798 = 2^1 + 6^2 + 4^3 + 6^4 + 7^5 + 9^6 + 8^7.

%p N:= 10: # to get solutions of up to N digits

%p Branch:= proc(level,sofar)

%p option remember;

%p local Res, x, x0, lb, ub, y;

%p Res:= NULL;

%p if perm[level] = 1 then x0:= 1 else x0:= 0 fi;

%p for x from x0 to 9 do

%p lb:= sofar + b[x,perm[level]] + scmin[level];

%p ub:= sofar + b[x,perm[level]] + scmax[level];

%p if lb <= 0 and ub >= 0 then

%p if level = n then Res:= Res, [x]

%p else

%p for y in Branch(level+1,sofar+b[x,perm[level]]) do

%p Res:= Res, [x, op(y)]

%p od

%p fi

%p fi

%p od;

%p [Res]

%p end:

%p count:= 0:

%p for n from 1 to N do

%p printf("Looking for %d digit solutions\n",n);

%p forget(Branch);

%p for j from 1 to n do

%p for x from 0 to 9 do

%p b[x,j]:= x^j - x*10^(n-j)

%p od

%p od:

%p for j from 1 to n do

%p smin[j]:= min(seq(b[x,j],x=0..9));

%p smax[j]:= max(seq(b[x,j],x=0..9));

%p od:

%p perm:= sort([seq(smax[j]-smin[j],j=1..n)],`>`,output=permutation):

%p for j from 1 to n do

%p scmin[j]:= add(smin[perm[i]],i=j+1..n);

%p scmax[j]:= add(smax[perm[i]],i=j+1..n);

%p end;

%p for X in Branch(1,0) do

%p xx:= add(X[i]*10^(n-perm[i]),i=1..n);

%p count:= count+1;

%p A[count]:= xx;

%p print(xx);

%p od

%p od:

%p seq(A[i],i=1..count); # _Robert Israel_, Aug 07 2014

%t f[n_] := Plus @@ (IntegerDigits[n]^Range[ Floor[ Log[10, n] + 1]]); Select[ Range[10^7], f[ # ] == # &] (* _Robert G. Wilson v_, May 04 2005 *)

%t Join[{0},Select[Range[10^7],Total[IntegerDigits[#]^Range[ IntegerLength[ #]]] == #&]] (* _Harvey P. Dale_, Oct 13 2015 *)

%t sdcpQ[n_]:=n==Inner[Power,IntegerDigits[n],Range[IntegerLength[n]],Plus]; Join[{0},Select[Range[27*10^5],sdcpQ]] (* _Harvey P. Dale_, May 30 2020 *)

%o (PARI) for(n=1,10^22,d=digits(n);s=sum(i=1,#d,d[i]^i);if(s==n,print1(n,", "))) \\ _Derek Orr_, Aug 07 2014

%Y Cf. A005188, A208130, A362843.

%K nonn,base,fini,full,nice

%O 1,3

%A _Patrick De Geest_, May 15 1998

%E Corrected by Macsy Zhang (macsy(AT)21cn.com), Feb 17 2002