cp's OEIS Frontend

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.

A351877 Nonnegative integers whose trajectory under iteration of taking the absolute value of the alternating sum of the cubes of the digits includes zero.

This page as a plain text file.
%I A351877 #34 Mar 09 2022 10:52:59
%S A351877 0,11,22,33,44,55,58,66,77,85,88,99,110,135,138,142,179,220,232,241,
%T A351877 256,267,284,328,330,345,346,387,396,429,440,464,482,486,531,543,550,
%U A351877 580,587,643,652,660,684,693,762,770,783,785,808,823,831,849,850,868,880,924,948,971,990
%N A351877 Nonnegative integers whose trajectory under iteration of taking the absolute value of the alternating sum of the cubes of the digits includes zero.
%C A351877 The sequence is infinite. Any number which is formed by concatenating two-digit multiples of 11 is a term.
%C A351877 To determine whether a given number k is a term of this sequence, start with k, take the cube of each digit of k, sum them together with alternating signs and take the absolute value of the result, apply the same process to the result, and continue until 0 is reached or a loop is entered. If 0 is reached, k is a term of this sequence. If not, k is not a term of this sequence.
%e A351877 346 is a term of the sequence since: 346->179->387->142->55->0.
%e A351877 8 is not a term since: 8->512->132->18->511->125->118->512 (we reached a loop of length 6 starting with 512).
%t A351877 Select[Range[10000],FixedPoint[Abs[Sum[(-1)^(n + 1)*Part[IntegerDigits[#]^3, n], {n, 1,Length[IntegerDigits[#]]}]] &, #, 30] == 0 &]
%o A351877 (Python)
%o A351877 def happyish_function(number, base: int = 10):
%o A351877   total = 0
%o A351877   times = 0
%o A351877   while number > 0:
%o A351877     total += pow(-1, times) * pow(abs(number) % base, 3)
%o A351877     number = abs(number) // base
%o A351877     times += 1
%o A351877   return abs(total)
%o A351877 def is_happyish(number: int) -> bool:
%o A351877   seen_numbers = set()
%o A351877   while number > 0 and number not in seen_numbers:
%o A351877     seen_numbers.add(number)
%o A351877     number = happyish_function(number)
%o A351877   return number == 0
%o A351877 print([k for k in range(1000) if is_happyish(k)])
%o A351877 (PARI) f(n) = my(d=digits(n)); abs(sum(k=1, #d, (-1)^k*d[k]^3)); \\ A351985
%o A351877 already(m, v) = {for (i=1, #v, if (v[i] == m, return (1)););}
%o A351877 isok(m) = {my(v=[]); while (m=f(m), if (already(m, v), return(0)); v = concat(v, m);); return(1);} \\ _Michel Marcus_, Feb 27 2022
%Y A351877 Cf. A345680, A351985.
%K A351877 nonn,base
%O A351877 1,2
%A A351877 _Luca Onnis_, Feb 23 2022