login
Base-16 Armstrong or narcissistic numbers (written in base 10).
14

%I #34 Apr 21 2022 10:55:57

%S 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,342,371,520,584,645,1189,1456,

%T 1457,1547,1611,2240,2241,2458,2729,2755,3240,3689,3744,3745,47314,

%U 79225,177922,177954,368764,369788,786656,786657,787680,787681,811239,812263,819424,819425,820448,820449,909360

%N Base-16 Armstrong or narcissistic numbers (written in base 10).

%C Whenever 16|a(n) (n = 22, 26, 33, 41, 43, 47, 49, 51, 53, 61, 116, 149, 157, 196, 198, 204, 206, 243, 247), then a(n+1) = a(n) + 1. Zero also satisfies the definition (n = Sum_{i=1..k} d[i]^k where d[1..k] are the base-16 digits of n), but this sequence only considers positive terms. - _M. F. Hasler_, Nov 22 2019

%H Joseph Myers, <a href="/A161953/b161953.txt">Table of n, a(n) for n=1..293</a> (the full list of terms, from Winter)

%H Henk Koppelaar and Peyman Nasehpour, <a href="https://arxiv.org/abs/2008.08187">On Hardy's Apology Numbers</a>, arXiv:2008.08187 [math.NT], 2020.

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

%H D. T. Winter, <a href="https://deimel.org/rec_math/dik2.htm">Table of Armstrong Numbers</a>

%e 645 is in the sequence because 645 is 285 in hexadecimal and 2^3 + 8^3 + 5^3 = 645. (The exponent 3 is the number of hexadecimal digits.)

%t Select[Range[10^7], # == Total[IntegerDigits[#, 16]^IntegerLength[#, 16]] &] (* _Michael De Vlieger_, Nov 04 2020 *)

%o (PARI) isok(n) = {my(b=16, d=digits(n, b), e=#d); sum(k=1, #d, d[k]^e) == n;} \\ _Michel Marcus_, Feb 25 2019

%o (PARI) select( is_A161953(n)={n==vecsum([d^#n|d<-n=digits(n,16)])}, [1..10^5]) \\ _M. F. Hasler_, Nov 22 2019

%o (Python)

%o from itertools import islice, combinations_with_replacement

%o def A161953_gen(): # generator of terms

%o for k in range(1,74):

%o a = tuple(i**k for i in range(16))

%o yield from (x[0] for x in sorted(filter(lambda x:x[0] > 0 and tuple(int(d,16) for d in sorted(hex(x[0])[2:])) == x[1], \

%o ((sum(map(lambda y:a[y],b)),b) for b in combinations_with_replacement(range(16),k)))))

%o A161953_list = list(islice(A161953_gen(),30)) # _Chai Wah Wu_, Apr 21 2022

%Y In other bases: A010344 (base 4), A010346 (base 5), A010348 (base 6), A010350 (base 7), A010354 (base 8), A010353 (base 9), A005188 (base 10), A161948 (base 11), A161949 (base 12), A161950 (base 13), A161951 (base 14), A161952 (base 15).

%K base,fini,full,nonn

%O 1,2

%A _Joseph Myers_, Jun 22 2009

%E Terms sorted in increasing order by _Pontus von Brömssen_, Mar 03 2019