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.

This page as a plain text file.
%I A239320 #52 May 28 2020 05:27:16
%S A239320 1,3,9,13,17,23,25,27,31,35,37,39,47,51,53,59,61,65,69,71,73,75,77,79,
%T A239320 81,85,89,91,93,101,105,107,109,111,117,137,141,143,153,155,159,161,
%U A239320 167,169,173,177,179,181,183,185,187,191,195,197,207,209,213
%N A239320 Ternary happy numbers.
%C A239320 Numbers where the trajectory of iterated application of A006287 ends at the fixed point 1.
%H A239320 Amiram Eldar, <a href="/A239320/b239320.txt">Table of n, a(n) for n = 1..10000</a>
%H A239320 H. G. Grundmann, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL13/Grundman/grundman7.html">Semihappy Numbers</a>, J. Int. Seq. 13 (2010), 10.4.8.
%e A239320 13 is a ternary happy number because 13=111_3 -> 1 + 1 + 1 = 3 = 10_3 -> 1 + 0 = 1.
%p A239320 isA239320 := proc(n)
%p A239320     t := A006287(n) ;
%p A239320     tloo := {} ;
%p A239320     for i from 1 do
%p A239320         if t = 1 then
%p A239320             return true;
%p A239320         end if;
%p A239320         if t in tloo then
%p A239320             return false;
%p A239320         end if;
%p A239320         tloo := tloo union {t} ;
%p A239320         t := A006287(t) ;
%p A239320     end do:
%p A239320 end proc:
%p A239320 for n from 1 to 300 do
%p A239320     if isA239320(n) then
%p A239320         printf("%d,",n) ;
%p A239320     end if;
%p A239320 end do: # _R. J. Mathar_, Jun 13 2014
%t A239320 happyQ[n_, b_] := NestWhile[Plus @@ (IntegerDigits[#, b]^2) &, n, UnsameQ, All] == 1; Select[Range[213], happyQ[#, 3] &] (* _Amiram Eldar_, May 28 2020 *)
%Y A239320 Cf. A007770, A240849.
%K A239320 nonn,base,easy
%O A239320 1,2
%A A239320 _Jiri Klepl_, Apr 13 2014