OFFSET
2,6
COMMENTS
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.)
LINKS
H. G. Grundman, E. A. Teeple, Generalized Happy Numbers, Fibonacci Quarterly 39 (2001), nr. 5, p. 462-466.
EXAMPLE
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.
MAPLE
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:
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:
# Martin Renner, Aug 24 2011
PROG
(Sage)
def A194281(n):
cycle_mins = set()
seen = {}
for i in (1..2*n**3):
if i not in seen:
path = []
while not i in path and not i in seen:
path.append(i)
i = sum(d**3 for d in i.digits(base=n))
if i not in seen:
m = min(path[path.index(i):])
if sf(m) != m: cycle_mins.add(m)
else: m = seen[i]
for p in path: seen[p] = m
return len(cycle_mins) # D. S. McNeil, Aug 24 2011
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Martin Renner, Aug 22 2011
STATUS
approved