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.

A239320 Ternary happy numbers.

Original entry on oeis.org

1, 3, 9, 13, 17, 23, 25, 27, 31, 35, 37, 39, 47, 51, 53, 59, 61, 65, 69, 71, 73, 75, 77, 79, 81, 85, 89, 91, 93, 101, 105, 107, 109, 111, 117, 137, 141, 143, 153, 155, 159, 161, 167, 169, 173, 177, 179, 181, 183, 185, 187, 191, 195, 197, 207, 209, 213
Offset: 1

Views

Author

Jiri Klepl, Apr 13 2014

Keywords

Comments

Numbers where the trajectory of iterated application of A006287 ends at the fixed point 1.

Examples

			13 is a ternary happy number because 13=111_3 -> 1 + 1 + 1 = 3 = 10_3 -> 1 + 0 = 1.
		

Crossrefs

Programs

  • Maple
    isA239320 := proc(n)
        t := A006287(n) ;
        tloo := {} ;
        for i from 1 do
            if t = 1 then
                return true;
            end if;
            if t in tloo then
                return false;
            end if;
            tloo := tloo union {t} ;
            t := A006287(t) ;
        end do:
    end proc:
    for n from 1 to 300 do
        if isA239320(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Jun 13 2014
  • Mathematica
    happyQ[n_, b_] := NestWhile[Plus @@ (IntegerDigits[#, b]^2) &, n, UnsameQ, All] == 1; Select[Range[213], happyQ[#, 3] &] (* Amiram Eldar, May 28 2020 *)