Tag Info

New answers tagged


Highlight the list and paste into a text file and then t=Import["put path of text file in here","Table"] t//MatrixForm works for me. Does it work for anyone else?


If $t, n$ are the triangular number and its position, then you want $n(n+1) = 2t$ Completing the square $n^2 + n + \frac{1}{4} = 2t + \frac{1}{4}$ and solving for positive n: $n = \sqrt{2t + \frac{1}{4}} - \frac{1}{2}$


Following the comment and your own implementation with Root it is better to define this: nthtri[t_] := Root[#^2 + # - 2 t &, 2] nthtri[28] 7 This has no unlocalized Symbols as your own version had. With your code if you set x = 5 before using it it will fail.


f is the function you are looking for: f[k_] := (1/2)*(-1 + Sqrt[1 + 8*k]); t[n_] := (1/2)*n*(1 + n); Table[f[t[k]], {k, 1, 10}]


Szabolcs's Past Tabular Data palette still works just like it should. This palette is so useful it is one of only two I always open on start-up. If for some reason you are looking for a one-off solution here is mine: Block[{Times = List}, (*paste here*) ] ~Partition~ 20 Reference: Convert head Times to List


Here is one way to import the grid into Mathematica Partition[ StringCases[ Import["http://projecteuler.net/problem=11", "Plaintext"], DigitCharacter ..][[10 ;; -8]], 20] // ToExpression


What you are getting is what you told the front-end to provide. Further, it is completely equivalent to the form you want -- it's just in raw input form rather than standard input form. In fact, you can convert it to your desired form by selecting it and keying Cmnd+Shift+N (Ctrl+Shift+N on some systems).


From very old documentation (I think Mathematica 4): Parentheses within a single RowBox by default grow to span whatever other objects appear in the RowBox. Some expandable characters, however, grow by default only to a limited extent. The latter seems to apply to square brackets. But we can overcome that by using a StyleBox: StyleBox [RowBox[{"[", ...


EDIT The CoefficientRules method given below won't work if one wants to collect by patterns like Log[_] or _Log (although it will work if the stuff inside the Log is explicitly given). In this case, my instinct is that Collect is then the way to go, and the method supplied by the OP will work pretty well as it is. CoefficientRules method Variables ...

Top 50 recent answers are included