Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
6

Create the right structure and then use TeXForm: CenterDot @@ Replace[ FactorInteger[4708352000], {b_, p_Integer} :> HoldForm[b]^p, {1} ] // TeXForm 2^{14}\cdot 5^3\cdot 11^2\cdot 19


5

It is possible to speed up your existing code even without compilation. The idea is to count not all configurations, but rather the topologically different ones. There are 3 topologically distinct possibilities to start a path Corner: 1, 3, 7, 9 Edge: 2, 4, 6, 8 Center: 5 Thus, it is sufficient to count the number of paths starting from 1 (n[1]), ...


4

You can use TeXForm to do most of the work for you. You only need to replace your custom operators with the built-in ones, so that TeXForm knows which symbols to use: makeTeX[expr_] := HoldForm[expr] /. {and -> And, or -> Or, not -> Not, Equal -> Congruent} // TeXForm makeTeX[and[or[c, a], not[and[a, b]]] == or[and[not[a], c], and[not[b], ...


4

Histogram[ StringLength[ ReadList[ StringToStream[ ExampleData[{"Text", "DonQuixoteIEnglish"}]], Word]], 20, ChartLabels -> Automatic]


2

("146d0" A + "-594d0" B) /. s_String?(StringStartsQ["-"]) :> -StringDrop[s, 1] (* "146d0" A - "594d0" B *)


2

In the same manner as yarchik's answer, but leveraging more symmetries. Also using ps as defined in the question. t = {2, 6}; u = {3, 6, 9}; eightfoldStarts = Thread /@ {{1, t}, {1, 5, {2, 3, 6}}, {1, 5, 9, t}, {2, u}, {2, 5, u}, {2, 5, 8, u}, {5, 1, t}, {5, 1, 9, t}, {5, 2, u}, {5, 2, 8, u}} // Catenate; finish[s : {__Integer}] := Join[...


2

Partition[ N@Chop@ToExpression@StringReplace[ "{" <> Import["file_path\temp.txt"] <> "}", {"#" ~~ Shortest[__] ~~ "\n" -> "", "\t" -> ",", "e+" -> "*^", "e-" -> "*^-"} ], 4 ] {{0.,0.,0.,0.25},{0.5,0.75,1.,1.25},{1.5,1.75,2.,2.25},{2.5,2.75,3.,3.25},{3.5,3.75,4.,4.25},<<449164>>,{0.,0.,0.,0.},{0.,0.,0.,0.},{0.,0....


1

To just take out the first line str = "# First line is a grid of y; Starting from second line: first number is a, second is temperature, next is set of numbers is corresponding to f(y) on the grid 0.000000e+00 0.000000e+00 0.000000e+00 2.500000e-01 5.000000e-01 0.100000e+00 0.000000e+01 0.010000e+02 2.500000e-02 5.000000e-02" (*...


1

There is a more concise and slightly faster pattern matching solution: impossible = {{1, 3}, {3, 1}, {4, 6}, {6, 4}, {7, 9}, {9, 7}, {1, 7}, {7, 1}, {2, 8}, {8, 2}, {3, 9}, {9, 3}, {1, 9}, {9, 1}, {3, 7}, {7, 3}}; possible = Permutations[Range[9], {4, 9}]; Count[possible, {___, PatternSequence @@@ Alternatives @@ impossible, ___}]; This takes ...


Only top voted, non community-wiki answers of a minimum length are eligible