%I #21 Aug 02 2023 11:42:53
%S 2,3,4,5,6,8,9,11,12,14,15,16,17,18,20,21,22,24,25,26,27,29,30,33,34,
%T 35,36,37,38,39,40,41,42,43,45,46,47,48,50,51,52,53,54,55,56,57,58,59,
%U 60,61,62,63,64,65,66,67,69,71,72,73,74,75,76,77,78,80,81,83
%N Unhappy numbers: numbers having period-8 2-digitized sequences.
%H Reinhard Zumkeller, <a href="/A031177/b031177.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Digitaddition.html">Digitaddition</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/UnhappyNumber.html">Unhappy Number</a>
%o (Haskell)
%o a031177 n = a031177_list !! (n-1)
%o a031177_list = filter ((/= 1) . a103369) [1..]
%o -- _Reinhard Zumkeller_, Aug 24 2011
%o (Python)
%o from itertools import count, islice
%o def A031177_gen(startvalue=1): # generator of terms >= startvalue
%o for n in count(max(startvalue,1)):
%o m = n
%o while m not in {1,37,58,89,145,42,20,4,16}:
%o m = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(m))
%o if m > 1:
%o yield n
%o A031177_list = list(islice(A031177_gen(),20)) # _Chai Wah Wu_, Aug 02 2023
%Y Complement of happy numbers A007770. Cf. A056527.
%Y Cf. A003132, A103369.
%K nonn,base
%O 1,1
%A _Eric W. Weisstein_
|