ListLinePlot of the length of the sequence of digits

I’m going through the language introduction course and I’m stuck on question 6.13. It asks, “Make a list line plot of the length of the sequence of digits for each of the first 100 squares.”

I started by doing a Table to make sure I was getting the right data:

Table[Length[IntegerDigits[k^2]], {k, 100}]

But when I swap Table for ListLinePlot…that’s where I’m having issues and the documentation is so obtuse. I changed it to what’s below but it errors out and I can’t seem to figure out the error (I added the spaces to make it more readable here).

ListLinePlot [ { [Length[IntegerDigits[k^2] ], {k, 100} ], 100} ]  

Thanks in advance!

A few comments:

  • Check out IntegerLength. That’ll clean things up a bit.
  • I don’t understand why you’re trying to “swap Table for ListLinePlot”. ListLinePlot needs a list of data, and Table produces a list of data, so you don’t want to swap, but you want to wrap.
  • This code ListLinePlot [ { [Length[IntegerDigits[k^2] ], {k, 100} ], 100} ] has a pretty obvious syntax error. I’m not sure if maybe that’s just an error in putting together your question or if the errors are in your actual code. Specifically, you’re using [ where there is no head preceding it, and that’s just a basic syntax error.

Is that enough help, or are you asking for actual working code that solves the problem?

Side note, is this tutorial online, and if so, can you provide a link to this question?

Don’t swap, use them in tandem. The plot following after the table. Like this:

Table[Length[IntegerDigits[k^2]], {k, 100}] // ListLinePlot

or like this:

ListLinePlot@Table[Length[IntegerDigits[k^2]], {k, 100}]

Eric, the question is from here. Exercise 6.8

Ah, I didn’t realize i needed to have the Table function in there too! That was it! Thank you very much!

I originally assumed it came from that tutorial, but the OP said is was question 6.13, and I don’t see any 6.13. Also, 6.8 makes it sound like we’re supposed to sum the digits. I’m confused.

It’s question 6.13 under the Exercises tab, I’m doing this training:

https://www.wolframcloud.com/obj/online-courses/an-elementary-introduction-to-the-wolfram-language/06-making-tables.html

Thanks!