Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 65814

Questions about Mathematica's procedural programming paradigm.

1 vote
1 answer
55 views

How to solve this with Nest?

Just get {10} from code below. jason[x_] := Module[{}, {b = 1}; b = b*Nest[# + 1 &, 1, x]; b] jason /@ Table[i, {i, 1, 10}] This gets it right with Do Results here{1, 2, 6, 24, 120, 720, 5040, 40 …
kile's user avatar
  • 1,892
3 votes
2 answers
90 views

What's wrong with While? Is it possible to use double While in a single code input? [closed]

I am supposed to get 2 in the output, but it is still -3 instead. ClearAll[t, n]; n = -10; While[True, If[n^2 + n - 6 == 0, Break[]]; n++]; t = n; While[True, If[t^2 + t - 6 == 0, Break[]]; t++]; …
kile's user avatar
  • 1,892
3 votes
2 answers
136 views

Iterating with Do rather than NestList

This code below works fine for me. factor[x_] := Module[{i = 1}, NestList[Module[{result}, result = #*i; i = i + 2; result] &, 1, x]]; factor[10] {1, 1, 3, 15, 105, 945, 1 …
kile's user avatar
  • 1,892