Understanding Array Elements: n^2 vs. 8*n

In summary, the conversation discusses a problem involving an array with n^2 elements and how it can contain 8*n elements when n is not equal to 8. The discussion also touches upon the use of algebra with an infinite number of elements and the role of infinite set theory in solving the problem. The main point is that the problem has a finite solution and does not require the use of infinite set theory.
  • #1
ehrenfest
2,020
1

Homework Statement


For the problem at this site http://www.kalva.demon.co.uk/putnam/psoln/psol859.html, how an array with n^2 elements contain 8*n elements (8 for each positive integer) when n is not equal to 8? Does that type of algebra not work with an infinite number of elements...?


Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
  • #2
The point is a_{ij}>i*j. You will run out of numbers at a finite point even if a_{ij} gets to be hugely large. It's not really a Cantor problem. The index set is the limit.
 
  • #3
Dick said:
The point is a_{ij}>i*j. You will run out of numbers at a finite point even if a_{ij} gets to be hugely large. It's not really a Cantor problem. The index set is the limit.

My point is that if you think of the number of elements in the array as

[tex]lim_{n\to \infty} n^2[/tex] then it at least seems odd that this number could be the same as [tex] lim_{n\to\infty}8n [/tex].

So, you are saying that logic only holds for finite sets, right?
That is probably just my ignorance of infinite set theory.
 
Last edited:
  • #4
The point is that you can find an N such that the number of pairs (i,j) with i*j<N is greater than 8*N. You could compute this N, if I'm doing my numbers right it's less than 10000. That means the problem doesn't have much to do with infinite set theory.
 

What is the difference between n^2 and 8*n in terms of array elements?

The notation n^2 refers to the number of elements in an array when it is squared, while 8*n refers to the number of elements in an array multiplied by 8. This means that n^2 is a quadratic relationship, while 8*n is a linear relationship.

Which notation is more efficient in terms of array operations?

In general, 8*n is more efficient than n^2 in terms of array operations. This is because linear relationships have a lower computational complexity compared to quadratic relationships, meaning that operations on arrays with 8*n elements will take less time and resources compared to arrays with n^2 elements.

How do n^2 and 8*n relate to the size of an array?

The size of an array can be represented by either n or n^2, depending on the dimensionality of the array. For example, a 1-dimensional array of length n will have n^2 elements, while a 2-dimensional array with n rows and n columns will have n^2 elements. Similarly, an array with 8*n elements can be interpreted as having a size of n or n/8, depending on the dimensionality of the array.

Under what circumstances would n^2 be more useful than 8*n?

n^2 would be more useful than 8*n when dealing with operations that require the array elements to be accessed or manipulated in a quadratic manner. For example, if a problem requires finding all possible combinations of elements in an array, n^2 would be a more appropriate representation of the array size rather than 8*n.

How can understanding array elements help in optimizing code?

By understanding the relationship between n^2 and 8*n, developers can make informed decisions about the size of arrays and the operations performed on them. For example, if a problem requires a large number of array operations, using an array with 8*n elements rather than n^2 elements can significantly improve the efficiency and speed of the code. This understanding can also assist in identifying potential bottlenecks and optimizing code for better performance.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
2K
  • Calculus and Beyond Homework Help
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
986
  • Calculus and Beyond Homework Help
Replies
3
Views
538
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Calculus and Beyond Homework Help
Replies
10
Views
1K
Replies
3
Views
1K
  • Programming and Computer Science
Replies
17
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
21
Views
2K
  • Calculus and Beyond Homework Help
Replies
10
Views
2K
Back
Top