Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'How to create a table of the number of steps?' topicStudent Support Forum > General > Archives > "How to create a table of the number of steps?"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Peter Pein
09/24/12 01:51am

Hi Jared,

don't forget 'FixedPointList'!

with the special case for n=1, I get:

A002217[1] = 2;(*Why??*)
A002217[n_Integer /; n > 1] :=
Length[FixedPointList[Plus @@ Times @@@ FactorInteger[#] &, n]] - 1

and e.g.

Grid@Partition[Array[A002217, 125], 25]

gives

2 1 1 1 1 2 1 3 3 2 1 2 1 4 4 4 1 4 1 4 3 2 1 4 3
5 4 2 1 3 1 3 5 2 3 3 1 4 5 2 1 3 1 5 2 4 1 2 5 3
5 2 1 2 5 2 3 2 1 3 1 6 2 3 5 5 1 4 6 5 1 3 1 6 2
2 5 5 1 2 3 2 1 5 3 3 4 2 1 2 5 5 3 6 5 2 1 5 2 5
1 3 1 2 5 6 1 2 1 5 3 5 1 5 3 6 2 2 5 5 3 3 6 4 5

hth,
Peter

URL: ,

Subject (listing for 'How to create a table of the number of steps?')
Author Date Posted
How to create a table of the number of steps? Jared E 09/21/12 3:43pm
Re: How to create a table of the number of steps? Bill Simpson 09/21/12 6:30pm
Re: How to create a table of the number of steps? Peter Pein 09/24/12 01:51am
< Previous CommentHelp | Reply To Comment | Reply To Topic