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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A194281 Number of cycles under iteration of sum of cubes of digits in base b. 3

%I #36 Mar 08 2020 11:41:34

%S 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 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 10,14,14,6,21,7,10,17,18,9,30,8,10,24,12,4,28,4,19,12,11,6,36

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

%C 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 H. G. Grundman, E. A. Teeple, <a href="http://www.fq.math.ca/Scanned/39-5/grundman.pdf">Generalized Happy Numbers</a>, Fibonacci Quarterly 39 (2001), nr. 5, p. 462-466.

%e 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 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 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 # _Martin Renner_, Aug 24 2011

%o (Sage)

%o def A194281(n):

%o cycle_mins = set()

%o seen = {}

%o for i in (1..2*n**3):

%o if i not in seen:

%o path = []

%o while not i in path and not i in seen:

%o path.append(i)

%o i = sum(d**3 for d in i.digits(base=n))

%o if i not in seen:

%o m = min(path[path.index(i):])

%o if sf(m) != m: cycle_mins.add(m)

%o else: m = seen[i]

%o for p in path: seen[p] = m

%o return len(cycle_mins) # _D. S. McNeil_, Aug 24 2011

%Y Cf. A193594, A194025.

%K nonn,base

%O 2,6

%A _Martin Renner_, Aug 22 2011

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 18:05 EDT 2024. Contains 371798 sequences. (Running on oeis4.)