The OEIS is supported by the many generous donors to the OEIS Foundation.

A351877
Nonnegative integers whose trajectory under iteration of taking the absolute value of the alternating sum of the cubes of the digits includes zero.
1
0, 11, 22, 33, 44, 55, 58, 66, 77, 85, 88, 99, 110, 135, 138, 142, 179, 220, 232, 241, 256, 267, 284, 328, 330, 345, 346, 387, 396, 429, 440, 464, 482, 486, 531, 543, 550, 580, 587, 643, 652, 660, 684, 693, 762, 770, 783, 785, 808, 823, 831, 849, 850, 868, 880, 924, 948, 971, 990
OFFSET
1,2
The sequence is infinite. Any number which is formed by concatenating two-digit multiples of 11 is a term.
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.
EXAMPLE
346 is a term of the sequence since: 346->179->387->142->55->0.
8 is not a term since: 8->512->132->18->511->125->118->512 (we reached a loop of length 6 starting with 512).
MATHEMATICA
Select[Range[10000], FixedPoint[Abs[Sum[(-1)^(n + 1)*Part[IntegerDigits[#]^3, n], {n, 1, Length[IntegerDigits[#]]}]] &, #, 30] == 0 &]
PROG
(Python)
def happyish_function(number, base: int = 10):
total = 0
times = 0
while number > 0:
total += pow(-1, times) * pow(abs(number) % base, 3)
number = abs(number) // base
times += 1
return abs(total)
def is_happyish(number: int) -> bool:
seen_numbers = set()
while number > 0 and number not in seen_numbers:
number = happyish_function(number)
return number == 0
print([k for k in range(1000) if is_happyish(k)])
(PARI) f(n) = my(d=digits(n)); abs(sum(k=1, #d, (-1)^k*d[k]^3)); \\ A351985
already(m, v) = {for (i=1, #v, if (v[i] == m, return (1)); ); }
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
CROSSREFS
Sequence in context: A013576 A065998 A364275 * A073729 A073730 A367610
KEYWORD
nonn,base
AUTHOR
Luca Onnis, Feb 23 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified September 20 16:24 EDT 2024. Contains 376074 sequences. (Running on oeis4.)