This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A345680 #38 Feb 24 2022 11:29:42 %S A345680 0,7,11,22,29,33,34,38,43,44,47,49,55,56,59,65,66,70,74,77,83,88,92, %T A345680 94,95,99,108,110,117,125,126,131,138,142,147,148,149,161,168,171,172, %U A345680 179,182,184,185,195,196,205,212,220,227,234,237,238,241,258,265,269 %N A345680 Nonnegative integers whose trajectory under iteration of taking the absolute value of the alternating sum of the squares of the digits (A257588) includes zero. %C A345680 The sequence was initially studied by a group of students at Clifton College, UK. %C A345680 There are infinitely many terms. %C A345680 Having checked up to 10^10, there are approximations for the lower and upper density: 0.23 and 0.25 respectively. %C A345680 Conjecture: there are strings of consecutive terms of arbitrary length. %C A345680 Any number which is formed by concatenating two-digit multiples of 11 is a term. %e A345680 For 7, the trajectory under iteration is 7, 49, 65, 11, 0, ..., so 7 is a term. %e A345680 For 11, the trajectory is 11, 0, ... %e A345680 For 22, the trajectory is 22, 0, ... %e A345680 For 29, the trajectory is 29, 77, 0, ... %e A345680 A non-example is 48. Its trajectory is 48, 48, ... %t A345680 Select[Range[1000], FixedPoint[ Abs[Sum[(-1)^(n + 1)*Part[IntegerDigits[#]^2, n], {n, 1, Length[IntegerDigits[#]]}]] &, #, 10] == 0 &] (* _Luca Onnis_, Feb 23 2022 *) %o A345680 (Python) %o A345680 def happyish_function(number, base: int = 10): # A257588 %o A345680 # iterates the process %o A345680 total = 0 %o A345680 times = 0 %o A345680 while number > 0: %o A345680 total += pow(-1, times) * pow(abs(number) % base, 2) %o A345680 number = abs(number) // base %o A345680 times += 1 %o A345680 return abs(total) %o A345680 def is_happyish(number: int) -> bool: %o A345680 # determines whether a number is happyish %o A345680 seen_numbers = set() %o A345680 while number > 0 and number not in seen_numbers: %o A345680 seen_numbers.add(number) %o A345680 number = happyish_function(number) %o A345680 return number == 0 %o A345680 def happyish_list(number: int): %o A345680 # creates their list %o A345680 happyish = [] %o A345680 n = 0 %o A345680 for i in range(number): %o A345680 if is_happyish(i) == True: %o A345680 n +=1 %o A345680 happyish.append(i) %o A345680 return happyish %o A345680 happyish_list(100) # an example %Y A345680 Cf. A257588 (iteration step). %Y A345680 Cf. A007770 (sum of squares not alternating). %K A345680 nonn,base %O A345680 1,2 %A A345680 _Stephen Cross_, Jun 23 2021