What are "d-smooth sequences?" - algorithm

I have a homework problem that tells me this:
I can't seem to make sense of what d-smooth means. Can someone please help explain it in a more understandable way? Thanks!

A sequence is d-smooth if you can increment/decrement each number at most d times to obtain a (strictly) increasing sequence.

Related

How does this equation for the Fibonacci sequence work using powershell?

The original equation is below:
$($c=$p=1; while ($c -lt 100) {$c; $c,$p=($c+$p),$c})
The portion I do not understand, is below:
{$c; $c,$p=($c+$p),$c}
Would anyone be able to explain what is happening in layman's terms?
Thank you, it is much appreciated.

In a lua for loop what is a # used for?

I know how for loops work and I use them quite often but also seem to often come across a # in others' code and I want to know what it is for and how to use it. An example of this would be:
for i = 1, #npc do local v = npc[i]
I cant seem to find anything online regarding this, maybe my searches just aren't good but it would be nice if someone could explain it for me, thanks.
In Lua, # is the length operator. for i = 1, #npc essentially loops from 1 to the length of the npc array.
As was already pointed out, it gets the length of a list. However, there's another thing worth pointing out: that for loop is suboptimal and unidiomatic. It would be better written as for i, v in ipairs(npc) do. In general, using # in a for loop is almost always the wrong thing to do.

can you help me about big o?

I need help about big O.
I'm not sure.
while (i<n){
while(j=n){
j++;
}//this is I think n*(n+1)
i++;//(n+1)
}//n
I need to tell me someone how calculate this if I'm wrong.
Have you put the question correctly?
It looks like the program will newer enter the inner loop or just enter it once. If the code is correct I would say it is just O(n).

What is this prolog output trying to say?

Years ago in college,I tinkered with some prolog, but that's long forgotten, so I count as a complete beginnner again (humbling!)
Anyway, I was playing with some of Bruce Tate's code, and came up with what I thought was a sudoku solver for the full (9x9) game. But, when I run it, it generates some very odd output:
Solution = [_#3(2..3),_#24(2:7),_#45(2..3:5:7),_#66(2..3:8),_#87(2..3:5..6:8),4,_#121(2:5..6),1,9,6,8,_#194(2..5:7:9),_#215(1..3:9),_#236(2..3:5:9),_#257(1..2:5:9),_#278(2:4..5),_#299(4:7),_#320(5:7),_#341(1..2),_#362(2:4),_#383(2:4..5:9),_#404(1..2:9),_#425(2:5..6:9),7,3,_#472(4:6),8,4,1,_#532(2:8),_#553(2:8),7,3,9,5,6,7,5,_#689(6:8),_#710(4:8..9),_#731(4:6:8..9),_#752(6:8..9),1,2,3,_#828(2..3),9,_#862(2..3:6),5,1,_#909(2:6),7,8,4,8,_#990(2:4:7),1,6,_#1037(2..5:9),_#1058(2:5:9),_#1079(4..5),_#1100(3..4:7),_#1121(5:7),5,_#1163(4:6..7),_#1184(4:6..7),_#1205(1:3..4:8),_#1226(3..4:8),_#1247(1:8),_#1268(4:6:8),9,2,9,3,_#1341(2:4:6),7,_#1375(2:4..5:8),_#1396(1..2:5:8),_#1417(4..6:8),_#1438(4:6),_#1459(1:5)]
yes
I was expecting ... well, frankly I was half expecting total failure :) but I thought that only numbers could show up in this output. What's it trying to tell me with those #-tagged things, and stuff in parens that looks like ranges? Is it trying to say there are many possible solutions and it's telling me all at once (seems unlikely as it's very unhelpful if it is) or is this some kind of error state (in which case, why does it compile my code and say "yes" to this query?)
Any insight gratefully received!
I think it's the result of a set of constraints not sufficiently strong to determine a solution without search. For instance, _#3(2..3) could means that a variable named _#3 could assume values in range 2..3. You could try to label the variables, something like
..., labeling([], Solution).
Syntax details depend on your solver, of course...

Mathematica. Two ArcCos functions which should give the same result are giving different results

I have written two lines of code in mathematica
Integrate[ArcCos[(1-(w/2t))],{w,0,F}]]
and
Integrate[ArcCos[-w/(2t)],{w,-2t,F-2t}]
where in both cases F < 2t.
I expect these two lines to give the same result but this is not the case. When I give try an equals it gives equals false.
Any help would be greatly appreciated.
Thank you very much for your help
James

Resources