13

I'm trying to figure out what the sentence below means.

Write code that creates a list of all integers from 50 to the power of 300.

I'm struggling with the "from 50 to the power of 300" part.

I've been googling for an hour now, but I've never heard "to the power of 300" without a base.

What does that mean? From 50 to what number? Is it possible that the teacher made a mistake?

So we came up with another way on how to interpret that, and given our previous exercises, this probably makes the most sense:

Write code that creates a list of all integer digits from 50 to the power of 300.

This would be still a little ambiguous, however we could interpret that as first calculating 50^300 and then creating a list of integers that includes each digit of 50^300 individually.

23
  • 11
    Most likely they mean "all the digits of" rather than "all integers from", ie write 50^300 in decimal. The sentence doesn't make sense from an English/Maths point-of-view and I suspect there are a number of charitable interpretations of it, but this would be mine if you don't have the opportunity for clarification.
    – Dannie
    Feb 25, 2021 at 14:10
  • 2
    50 to the power of 300 is just a very large number (probably way more than the number of atoms in the entire universe). But substituting a slightly smaller "large number", we'd have [Please] list all integer digits from a million, which obviously makes no real sense. We could contrive an interpretation based on the meaning starting from a million, but since there are infinitely many integers beyond 1,000,000, that doesn't make much sense. Feb 25, 2021 at 14:32
  • 5
    I’m voting to close this question because it's asking us to analyse garbage text Feb 25, 2021 at 14:33
  • 3
    Is there some reason why you can't ask the person who wrote that sentence to clarify what they meant?
    – ColleenV
    Feb 25, 2021 at 21:28
  • 26
    Speaking as a university prof: please, please, just ask for clarification if your homework assignment seems unclear (rather than speculating wildly what the intent of a task with a minor typo is). Typos happen, and they are fixed extremely quickly. It's much more annoying to deal with the fallout of a bunch of students going on a hog chase of how to generate all integers larger than a certain value ...
    – xLeitix
    Feb 26, 2021 at 6:55

8 Answers 8

27

The way you have presented it, the statement makes no sense in terms of finite computation*. If you have copied the words correctly then the teacher has made a mistake.

Are you 100% certain that you have transcribed every word perfectly? Please double check and, if the text is exactly as presented, ask your teacher to clarify.


*The reason is that, as it stands, it is asking for an infinite list. It is possible to compute the integer 50^300. The answer has 510 digits in decimal notation - it is huge! However you are then asked to calculate "all integers from" that number. There is an infinite number of integers that are greater than 50^300 so it would take an infinite amount of time to calculate them. Not only that but you also have to store them in a list!

Your teacher would not get the whole list even after the end of the universe.


As a matter of interest, 50^300 is

4909093465297726553095771954986275642975215512499449565111549117187105
2547217158564600978840373319522771835715651318785131679186104247189028
0751482410896345225310546445986192853894181098439730703830718994140625
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000

But of course you now have to count from that number until infinity and store the results!

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Eddie Kal
    Feb 27, 2021 at 15:39
6

From a mathematical angle and a logical angle, the question does not make sense as it stands, and unfortunately it does not make sense in more than one way, so we can't easily assume what it was meant to convey, either.

The question is asking for a contiguous list of integer numbers ("all"). When asking for this, you have to specify a range, i.e. a start value and an end value. It is possible that the start value is supposed to be 50, as in "from 50 to {some other value}", or it is possible that it is missing. If the start value was omitted, it would make sense to assume that "50 to the power of 300" is a correctly specified end value.

It is equally possible that 50 is the start value of the range and that the specifiction of the end value is incomplete, as in "from 50 to {something to} the power of 300". In this case, the "something" is cricially missing, because you need to know "something" before you can calculate it's power of 300.

Either way, the specification of the range is incomplete, we don't know what the original intent was, and as the problem statement stands, it makes no sense and cannot be solved.

A equally incomplete problem statement would be:

How many people can you fit in between the wall and the red?

The "red" what!? is the obvious response.

5

It seems likely from the sentence structure that something is missing, as you have suggested. However the task as written can be interpreted in a way that makes sense. If you write a program that lists the integers beginning with 50 ^ 300 you would have accomplished the task, in that every required number will eventually be in the list. It might only be a short task to write the program even though it would need to run for ever.

12
  • 1
    I challenge you to try this. The largest integer that can be represented in 64-bits is 2^64-1 - How are you going to do arithmetic with numbers that are 50^300 and bigger? You would have to implement variable-precision arithmetic first. Feb 25, 2021 at 18:01
  • 7
    @chasly-supportsMonica: import itertools; result=itertools.count(start=50**300); next(result). Done Feb 25, 2021 at 20:54
  • 2
    @chasly-supportsMonica No, it's easy and can be done with 4-bit arithmetic. Start with the string representation of 50^300 shown in another answer. The low digits are 0 anyway, so you just need an algorithm to start producing numbers from 0. Add one, if 10 is reached, handle carry. Print string, repeat. Could be a one-liner in C.
    – Jens
    Feb 25, 2021 at 20:54
  • 3
    @chasly-supportsMonica There are a lot of programming languages in which it's easy to write a program which—theoretically, and if the program is executed according to the specification of the programming language—will output every integer greater than or equal to 50^300. I'll grant that today's operating systems are incapable of allowing programs to access an infinite amount of memory even if the computer has an infinite amount of memory, but that fact has no bearing on the theoretical correct behavior of a computer program. Feb 25, 2021 at 21:39
  • 1
    @chasly-supportsMonica I think we disagree on what counts as an "implementation." To me, any computer program written in an acceptable programming language (which would include, say, C, Lua, Haskell, or the untyped lambda calculus) counts as an "implementation." To you, an "implementation" must be a computer program that would actually run on the type of computer system that you have in mind. I don't know exactly what type of computer system you have in mind, but I can infer that it's one that's attached to an infinite memory device which today's operating systems cannot use. Feb 25, 2021 at 23:10
4

As Peter pointed out, it may be a request to write a program that never ends, a program that computes every integer starting from 50^300 onward. But such request gets special meaning in the context of programming languages that allow for lazy evaluation, like Haskell.

Infinite lists in those languages does not mean that the code will compute forever, but that a list is a recipe that will be computed on demand, depending on how other parts of the program uses it (hence, "lazy" evaluation, because values are only computed when needed).

In this context (for instance, if this is an assignment from a class that teaches Haskell), the sentence gains a new light and does not feel as incomplete, because code that potentially never ends are commonplace and objectively useful.

12
  • Does Haskell have built-in variable-precision arithmetic? If not, you can't even get started. Feb 25, 2021 at 18:02
  • Built-in Integer type is arbitrary precision, which is deducted when you write 50^300.
    – lvella
    Feb 25, 2021 at 18:29
  • That's interesting. I've never used or studied Haskell - I'm retired now and don't need to but it could be interesting. I suggest you ask the OP what language(s) they are expected to use. The problem for me though is, even if Haskell does this, why set such an apparently arbitrary starting point? Also, how do you specify when to stop? You would have to write a user program to drive this procedure. In that case we're back to an infinite loop requiring infinite memory to store the list. The teacher still needs to specify a stopping point. If it's abstract, why specify a start point? Feb 25, 2021 at 18:47
  • 1
    In a Haskell terminal (which is much like a Python terminal), if you write a = [50^300..] and press enter, by any Haskell standards, you have effectively defined an infinite list starting from 50^300. If you want to actually display the list (type a and press enter, for instance), it will obviously never stop printing until you cancel it, but expression a has a type List of Integers (Haskell is strongly typed), and can be passed to any function that takes a List of Integers.
    – lvella
    Feb 25, 2021 at 18:50
  • 2
    My intention with this answer is just to point that the sentence does have an specific and very natural meaning in the context of lazy evaluation programming languages.
    – lvella
    Feb 25, 2021 at 18:59
2

There's another unlikely but possible interpretation that also barely makes sense: the infinite list
[50**300, 51**300, 52**300, ...]

It wouldn't be a good way to give an assignment to students: assignments should clearly and unambiguously describe exactly what problem you're supposed to solve, or what the code is supposed to do. Therefore it's highly unlikely this is what was intended. It's also only possible in a programming language that allows creation of infinite lists (e.g. Haskell I think, where they can be lazily evaluated.)

Parsing the sentence this way would fit even better if there was a comma where I placed one, but I think it's possible to interpret this way even without.

creates a list of all integers from 50, to the power of 300.

So your list is of all the integers "from 50" (another way to say "50 and up"), and every element of that list is raised to the power 300.

This list is IMO slightly more interesting than contiguous integers starting with 50**300, 50**300 + 1, but both interpretations are at least somewhat valid. The +1, +2, ... version is a somewhat better fit for the phrasing, but this is the interpretation that occurred to me first, when mentally searching for a way it could possibly make any sense.


Write code that creates a list of all integer digits of 50^300

Yes, that's possibly what your teacher meant to say, especially if English isn't their native language or they simply made a typo. But it's not possible as an exact literal interpretation of that the assignment did say.

"all integers from x" definitely doesn't mean "the base-10 digits of x". It has no standard meaning.

1

It means that whoever posed that question isn't very good at writing questions, not very good at English, or both.

"The power of 300" is meaningless. There is no mathematical property named "power" that numbers could have. Numbers have powers; the "first power" is the number itself, the "second power" is the number squared, and so on. "x to the power of 300" or "x raised to the 300th power" or "the 300th power of x" all make sense, they are all the result of starting with 1 and multiplying by x, repeated 300 times.

-2

The way to parse this in mathematical English is:

 Write code that creates
 a list of
 all integers
 from
 50 to the power of 300

where each line is parsed distinctly.

 Write code that creates
 a list of
 X
 from
 Y

means treat Y as a description of a set or collection of elements, and they want you to create a list of elements that qualify as X from that set or collection, and make a list of them.

The problem is that "50 to the power of 300" is itself an integer. And an integer is not a collection of integers.

You can attempt to read "50 to the power of 300" as a collection of integers; if it was "A to B" where both A and B where numbers, that would have a clear meaning (well, somewhat clear; if it includes the endpoints would be ambiguous). But while "50" describes a number, "the power of 300" does not.

You could invent a base (like 10), but that is stretching it.

So we treat "50 to the power of 300" as a single number.

So now we have:

 Write code that creates
 a list of
 all integers
 from
 some number

the teacher probably means digits. If the teacher was being a silly set theoretical mathematician, one construction of the natural numbers is that each natural number is the set of all of its predecessors; so zero is the empty set, 1 is the set containing 0, 2 is the set containing 1 and 0, etc. But I'd bet a fair amount of money that your teacher does not mean this, unless you are taking an introductory course in formal mathematics foundations of some kind.

So make a list of the digits.

Note that in some dialects of non-mathematical English, "all of the X from Y" can mean "starting at Y and going on, all of the X". This is not something you would ever mean in the mathematical sub-dialect of English.

-3

This might theoretically make sense, with a sufficiently large integer type.

Like the other answers, I'm going to say that based on what you've written, your teacher wants a list of all integers, starting with 50^300. However, this is neither impossible, nor an unending infinite task, because this is being asked about in the context of computers.

In computers, integers cover a finite span based on the amount of memory allocated to them. For instance, in Java, the primitive int type uses 32 bits of memory with the first bit being allocated to determining whether the int is positive or negative, resulting in a maximum positive value of 2^31-1 (2,147,483,647) and a maximum negative value of 2^31. This is obviously far smaller than the value of 50^300, since both the base and the exponent are far larger than than the value allowed by the primitive int type.

However, there are additional Java classes that allow you to increase this size, such as the Java BigInteger class, which allows you to set its length in bits, up to the normal integer size limit (approximately 2 gigabytes of memory for each such number). Such a massive size would be overkill, and it would likely take an obscene amount of time to run to completion; it would likely be much more efficient to use a far smaller number of bits.

50^300, expressed in base 2, is just under 1,700 digits long, so fastest (but still extremely slow) way to do it would be to store 50^300 in a binary number exactly long enough to store it, 1,694 bits long. It would still be take an obscene amount of time, however - running it on the CPU of an XBox Series X (as an example of a generic modern computer), with a clock speed of 3.6 GHz, it would still take about 10^482 times the current age of the universe to finish counting up to its maximum value.

3
  • 3
    This is both ridiculous and utterly unrelated to the English language.
    – TypeIA
    Feb 25, 2021 at 13:24
  • @TypeIA The other answers were talking about a counting process that would take literally forever. This way would at least theoretically have a stopping point.
    – nick012000
    Feb 25, 2021 at 20:46
  • 1
    That might be an interesting topic for a programming site!
    – TypeIA
    Feb 25, 2021 at 21:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .