Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A089605
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A089605 Let P(m) = m/2 if m is even, m + rev(m) if m is odd, where rev(m) is m's base 10 representation reversed. It is conjectured that any number k eventually cycles when P is repeatedly applied to it. Sequence gives number of steps before the cycle is reached. +0
2
0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 2, 0, 1, 3, 3, 0, 1, 1, 1, 0, 1, 2, 1, 3, 1, 1, 1, 2, 2, 4, 0, 4, 3, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 2, 1, 3, 3, 2, 1, 4, 3, 2, 0, 2, 2, 2, 1, 3, 1, 3, 1, 5, 1, 0, 3, 5, 2, 4, 3, 2, 1, 2, 2, 3, 0, 3, 4, 3, 1, 2, 1, 3, 3, 2, 2, 2, 4, 2, 1, 3, 2, 2, 1, 4, 4, 4, 0, 3, 0, 2, 2, 5 (list; graph; listen)
OFFSET

0,9

EXAMPLE

5 -> 10 -> 5 -> ..., so 5 is already in a cycle and a(5) = 0. 13 -> 44 -> 22 -> 11 -> 22 -> ..., so a(13) = 2.

MATHEMATICA

Step[n_] := If[ EvenQ[n], n/2, n + FromDigits[ Reverse[ IntegerDigits[n]]]]; cPalHash = 1013; clearArray = Array[{} &, cPalHash]; InsertCheck[n_, a_] := Module[{i = Mod[n, cPalHash] + 1}, a[[i]] = Append[a[[i]], n]]; SetAttributes[ InsertCheck, HoldRest]; CheckArray[n_, a_] := MemberQ[ a[[Mod[n, cPalHash] + 1]], n]; SetAttributes[ CheckArray, HoldRest]; PalListHelper[n_, cTries_] := Module[{ch = clearArray}, NestWhileList[ (InsertCheck[ #, ch]; Step[ # ]) &, n, Not[ CheckArray[ #, ch]] &, 1, cTries]]; PalList[n_, cTries_] := Module[{lst, nRemoved, loop}, lst = PalListHelper[n, cTries]; nRemoved = First[ First[ Position[lst, lst[[ -1]]]]]; loop = Drop[ Take[lst, {nRemoved, -1}], -1]; Append[ Take[lst, {1, nRemoved - 1}], loop]]; Table[ Length[ PalList[n, 1013]] - 1, {n, 0, 104}] (from Darrell Plank (jar_czar(AT)msn.com), Dec 28 2003)

CROSSREFS

Cf. A089381.

Sequence in context: A079126 A025891 A120630 this_sequence A060016 A117408 A079100

Adjacent sequences: A089602 A089603 A089604 this_sequence A089606 A089607 A089608

KEYWORD

nonn,base,easy

AUTHOR

N. J. A. Sloane (njas(AT)research.att.com), Jan 01 2004

EXTENSIONS

More terms from John W. Layman (layman(AT)math.vt.edu) and Robert G. Wilson v (rgwv(AT)rgwv.com), Jan 05 2004

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified December 11 12:57 EST 2009. Contains 170656 sequences.


AT&T Labs Research