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.

A194281 Number of cycles under iteration of sum of cubes of digits in base b.

This page as a plain text file.
%I A194281 #38 Jan 05 2025 19:51:39
%S A194281 0,1,0,1,1,8,1,4,4,6,2,12,3,7,8,7,3,16,3,6,7,7,4,14,1,8,11,7,2,20,7,5,
%T A194281 16,9,7,18,4,7,10,6,4,24,5,5,13,6,7,25,2,10,20,6,5,23,7,7,17,9,7,29,3,
%U A194281 10,14,14,6,21,7,10,17,18,9,30,8,10,24,12,4,28,4,19,12,11,6,36
%N A194281 Number of cycles under iteration of sum of cubes of digits in base b.
%C A194281 If b>=2 and n >= 2*b^3, then S(n,3,b)<n. For each positive integer n, there is a positive integer m such that S^m(n,3,b)<2*b^3. (Grundman/Teeple, 2001, Lemma 8 and Corollary 9.)
%H A194281 H. G. Grundman, E. A. Teeple, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/39-5/grundman.pdf">Generalized Happy Numbers</a>, Fibonacci Quarterly 39 (2001), nr. 5, p. 462-466.
%e A194281 In the decimal system all integers go to (1); (153); (370); (371); (407) or (55, 250,133); (136, 244); (160, 217, 352); (919, 1459) under the iteration of sum of cubes of digits, hence there are five fixed points, two 2-cycles and two 3-cycles. Therefore a(10) = 2 + 2 = 4.
%p A194281 S:=proc(n,p,b) local Q,k,N,z; Q:=[n]; for k from 1 do N:=Q[k]; z:=convert(sum(N['i']^p,'i'=1..nops(N)),base,b); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
%p A194281 a:=proc(b) local Z,i,A,Q,B,C; A:=[]: for i from 1 to 2*b^3 do Q:=S(convert(i,base,b),3,b); A:={op(A),Q[nops(Q)]}; od: Z:={}: for i from 1 while nops(A)>0 do B:=S(A[1],3,b); C:=[seq(B[i],i=1..nops(B)-1)]: if nops(C)<>1 then Z:={op(Z),C}: fi: A:=A minus {op(B)}; od: return(nops(Z)); end:
%p A194281 # _Martin Renner_, Aug 24 2011
%o A194281 (Sage)
%o A194281 def A194281(n):
%o A194281     cycle_mins = set()
%o A194281     seen = {}
%o A194281     for i in (1..2*n**3):
%o A194281         if i not in seen:
%o A194281             path = []
%o A194281             while not i in path and not i in seen:
%o A194281                 path.append(i)
%o A194281                 i = sum(d**3 for d in i.digits(base=n))
%o A194281             if i not in seen:
%o A194281                 m = min(path[path.index(i):])
%o A194281                 if sf(m) != m: cycle_mins.add(m)
%o A194281             else: m = seen[i]
%o A194281             for p in path: seen[p] = m
%o A194281     return len(cycle_mins) # _D. S. McNeil_, Aug 24 2011
%Y A194281 Cf. A193594, A194025.
%K A194281 nonn,base
%O A194281 2,6
%A A194281 _Martin Renner_, Aug 22 2011