New answers tagged

3

Clear["Global`*"] sol = Solve[{Mod[3 x + 7, 2] == 0}, x, Integers][[1]] (* {x -> ConditionalExpression[1 + 2 C[1], C[1] ∈ Integers]} *) Mod[x + 3, 2] == 0 /. sol // Simplify[#, Element[C[1], Integers]] & (* True *)


5

Assuming you trying to compute the sum of the digits for each of the first 30000 multiples of 31 Array[31*# &, 30000] // Map[Total[IntegerDigits[#]] &]


-1

I think you want NestList: mylist[n_: Integer] := NestList[# + RandomInteger[{1, 6}] &, 0, n]


2

Henrik Schumacher has shown how to use FoldList to do the accumulation. All you need to get what you want is a way to generate n random integers in the ranges 1–6. You can do that with a single call to RandomInteger: RandomInteger[{1, 6}, n] Your function should take n, the number of tosses as it argument.


Top 50 recent answers are included