text:
Generate a modulo rosace
The cool stuff
The following rosace can help calculate numbers modulo 7.

In order to do that, you must start at 0 and turn clockwise a number of steps given by the first digit. Then, for each successive digit, follow the arrow and then turn clockwise the number of steps given by that digit.
Here is how you proceed for number 294:

You start at circle 0.
You turn clockwise the number of steps given by the first digit (which is a 2, you end up at 2).
You follow the arrow there (you end up at 6).
You turn clockwise the number of steps given by the second digit (which is a 9, you end up at 1).
You follow the arrow there (you end up at 3).
You turn clockwise the number of steps given by the third number (which is 4, you end up at 0).
294 mod 7 = 0 (meaning 294 is multiple of 7).

(Video explanation if you still didn't get it)
The goal
Figure out how that works (I know but I won't tell you).
Create a program that takes a number n in parameter and that generates a rosace for mod n.
The rosace can be displayed by any means you want (ASCII, generate PNG, generate SVG, ...) as long as it could be used by a 8 years old child (so no list of rules, I want a picture)!
You can use strait lines, even if it's a bit less clear than what I made for the example, but you must show clearly the numbers that point to themselves with some kind of tail-biting arrow.
Test cases
(I only give the links between the numbers, feel free to edit my question once your program sucessfully generates them)
mod 2:
0 -> 0
1 -> 0

mod 3:
0 -> 0
1 -> 1
2 -> 2

mod 4:
0 -> 0
1 -> 2
2 -> 0
3 -> 2

mod 5:
0 -> 0
1 -> 0
2 -> 0
3 -> 0
4 -> 0

mod 6:
0 -> 0
1 -> 4
2 -> 2
3 -> 0
4 -> 4
5 -> 2

mod 7:
0 -> 0
1 -> 3
2 -> 6
3 -> 2
4 -> 5
5 -> 1
6 -> 4

mod 8:
0 -> 0
1 -> 2
2 -> 4
3 -> 6
4 -> 0
5 -> 2
6 -> 4
7 -> 6

mod 9:
0 -> 0
1 -> 1
2 -> 2
3 -> 3
4 -> 4
5 -> 5
6 -> 6
7 -> 7
8 -> 8

mod 10:
0 -> 0
1 -> 0
2 -> 0
3 -> 0
4 -> 0
5 -> 0
6 -> 0
7 -> 0
8 -> 0
9 -> 0

Rules
This is code-golf, shortest code in bytes wins.
As usual, loopholes and cheats are forbidden.

For those who (like me) dislike video explanations, as opposed to text: http://mindyourdecisions.com/blog/2015/07/26/divisibility-by-7-test-using-a-graph-why-does-it-work-sunday-puzzle/#.VbV4SvlVhBc

@SteeveDroz Is the format I use in my answer okay?

Mathematica, 192 bytes
This type of challenge (nontrivial mathematical computation together with high-level graphics output) is what Mathematica is made for!
(d=#;r_~t~n_:=r{Sin[#],Cos[#]}&[6.3n/d];m=Mod[10#,d]&;Graphics@{Array[#~Text~t[9,#]&,d,0],Array[Arrow@{t[9,#+1/7],t[9,#+6/7]}&,d],Array[Arrow@BezierCurve@{t[8,#+1/9],{0,0},t[8,m@#-1/9]}&,d]})&

Expanded and explained:
[1] (
[2] d = #; r_~t~n_ := r {Sin[#], Cos[#]} &[6.3 n/d]; m = Mod[10 #, d] &;
[3] Graphics@{
[4]   Array[#~Text~t[9, #] &, d, 0],
[5]   Array[Arrow@{t[9, # + 1/7], t[9, # + 6/7]} &, d],
[6]   Array[Arrow@BezierCurve@{t[8, # + 1/9], {0, 0}, t[8, m@# - 1/9]} &, d]
[7]          }
[8] ) &

Lines 1 and 8 delimit an unnamed function of one argument. Lines 3 and 7 delimit several commands that output graphics.
Lines 2 stores the input as d; defines a binary function t giving the coordinates of a point n/d of the way around the circle of radius r, clockwise from the top (in the spirit of this site, I saved a byte by rounding 2π to 6.3!); and defines a unary function m calculating the destination of the arrow starting at its argument.
Line 4 renders the numbers 0 to d–1 equally spaced around the circle of radius 9 (the exact radius unimportant, chosen to maximize aesthetics subject to fitting in one byte).
Line 5 renders the clockwise straight arrows around the circumference of the circle. The 1/7 and 6/7 leave enough space to read the numbers.
Line 6 renders the curved arrows from each number to (10 times the number modulo d). BezierCurve automatically draws a Bézier curve using the given control points. Fortunately, using the origin as a single interior control point produces reasonable output.
Sample output (note that the cases 9, 10, and 11 are trivial in different ways):
d = 7

d = 8

d = 9

d = 10

d = 11

d = 12

d = 13

d = 37

This last input was chosen because 37 divides 10^3–1, and so the interior arrows (not counting the obligatory self-arrow from 0 to 0) form lots of triangular cycles.

Looking at the output for d = 37, I'm much older than 8 and I'll have a hell of a time following that O_O

And yet, especially magnified, it's completely followable! (if we know the rules) But yeah, spending more bytes could make it much more visually user-friendly.

Python 2, 294 bytes
n=input()
r,R="",range(n)
for i in R:r+=["   ","__ "][10*i%n==i]
r+="\n"
for i in R:r+=["   ","|/ "][10*i%n==i]
print r
print">>".join(map(str,R))
for i in R:
    o,r=10*i%n,""
    for j in R:
        r+="|"
        if i<=j<o:r+=">>"
        elif i>j>=o:r+="<<"
        else:r+="  "
    print r

Prints the diagram in this format:
__
|/
0>>1>>2>>3>>4>>5>>6
|  |  |  |  |  |  |
|  |>>|>>|  |  |  |
|  |  |>>|>>|>>|>>|
|  |  |<<|  |  |  |
|  |  |  |  |>>|  |
|  |<<|<<|<<|<<|  |
|  |  |  |  |<<|<<|

I don't know if this format is okay, therefore I'll leave this answer as invalid for the time being. Yay, it's valid!
Try it on repl.it!

@DJMcMayhem The OP did say ASCII art is allowed, so it's up to the OP.

This looks great! You should try to set up the formatting so it works with n-digit numbers. I'm not sure if the challenge requires you to do it for n>9 though.

Looks good to me, it doesn't need more explanation than the original example.

PHP+SVG, 500 Bytes
little arrow for connections between same values
<svg viewBox=0,0,500,500><def><marker id=t viewBox=0,0,9,9 refX=1 refY=5 orient=auto><path d=M0,0L10,5L0,10z /></marker></def><circle cx=250 cy=250 r=150 fill=#ccc /><?for($i=0;$i<$n=$_GET[n];$i++){$w=deg2rad((($i*10%$n)-$i)*360/$n);echo"<g transform=rotate(".$i*360/$n.",250,250)><path d=M250,110L".(250+(sin($w)*135)).",".(250-cos($w)*145)." fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>$i</text></g>";}?></svg>

to see the arrows to the same values I use this color value rgba(255,0,0,0.3) . it is a possibility to short it down.
expanded
    <svg viewBox=0,0,500,500>
<def>
<marker id=t viewBox=0,0,10,10 refX=1 refY=5 markerWidth=5 markerHeight=5 orient=auto>
<path d=M0,0L10,5L0,10z />
</marker>
</def>
<circle cx=250 cy=250 r=150 fill=#ccc stroke=#a00 />
<?php for($i=0;$i<$n=$_GET[n];$i++){
$w=deg2rad((($i*10%$n)-$i)*360/$n);
echo"<g transform=rotate(".$i*360/$n.",250,250)>
<path d=M250,110L".(250+(sin($w)*135)).",".(250-cos($w)*145)." fill=none stroke=#0f0 marker-end=url(#t) />
<circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) />
<text x=250 y=105 text-anchor=middle>$i</text>
</g>";
}?>
</svg>

output for n=45

<svg viewBox=0,0,500,500><def><marker id=t viewBox=0,0,10,10 refX=1 refY=5 markerWidth=5 markerHeight=5 orient=auto><path d=M0,0L10,5L0,10z /></marker></def><circle cx=250 cy=250 r=150 fill=#ccc stroke=#a00 /><g transform=rotate(0,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>0</text></g><g transform=rotate(8,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>1</text></g><g transform=rotate(16,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>2</text></g><g transform=rotate(24,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>3</text></g><g transform=rotate(32,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>4</text></g><g transform=rotate(40,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>5</text></g><g transform=rotate(48,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>6</text></g><g transform=rotate(56,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>7</text></g><g transform=rotate(64,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>8</text></g><g transform=rotate(72,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>9</text></g><g transform=rotate(80,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>10</text></g><g transform=rotate(88,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>11</text></g><g transform=rotate(96,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>12</text></g><g transform=rotate(104,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>13</text></g><g transform=rotate(112,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>14</text></g><g transform=rotate(120,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>15</text></g><g transform=rotate(128,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>16</text></g><g transform=rotate(136,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>17</text></g><g transform=rotate(144,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>18</text></g><g transform=rotate(152,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>19</text></g><g transform=rotate(160,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>20</text></g><g transform=rotate(168,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>21</text></g><g transform=rotate(176,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>22</text></g><g transform=rotate(184,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>23</text></g><g transform=rotate(192,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>24</text></g><g transform=rotate(200,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>25</text></g><g transform=rotate(208,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>26</text></g><g transform=rotate(216,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>27</text></g><g transform=rotate(224,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>28</text></g><g transform=rotate(232,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>29</text></g><g transform=rotate(240,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>30</text></g><g transform=rotate(248,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>31</text></g><g transform=rotate(256,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>32</text></g><g transform=rotate(264,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>33</text></g><g transform=rotate(272,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>34</text></g><g transform=rotate(280,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>35</text></g><g transform=rotate(288,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>36</text></g><g transform=rotate(296,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>37</text></g><g transform=rotate(304,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>38</text></g><g transform=rotate(312,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>39</text></g><g transform=rotate(320,250,250)><path d=M250,110L250,105 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>40</text></g><g transform=rotate(328,250,250)><path d=M250,110L378.39262969985,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>41</text></g><g transform=rotate(336,250,250)><path d=M250,110L329.35100905948,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>42</text></g><g transform=rotate(344,250,250)><path d=M250,110L170.64899094052,367.30746418437 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>43</text></g><g transform=rotate(352,250,250)><path d=M250,110L121.60737030015,205.19253581563 fill=none stroke=#0f0 marker-end=url(#t) /><circle cx=250 cy=100 r=10 fill=rgba(255,0,0,0.3) /><text x=250 y=105 text-anchor=middle>44</text></g></svg>

320 Bytes working with rect
<svg viewBox=0,0,<?=$w=30+10*$n=$_GET[n]?>,<?=20*$n?>><?for($i=0;$i<$n;$i++)echo"<rect x=0 y=".($y=$i*20)." fill=none width=$w height=20 stroke=grey /><text x=5 y=".($y+17).">$i</text><path d=M".($x=$i*10+25).",".($y+17)."L$x,".($m=($i*10%$n)*20+5)." fill=none stroke=blue /><circle cx=$x cy=$m r=2 fill=#0f0 />"?></svg>

expanded
<svg viewBox=0,0,<?=$w=30+10*$n=$_GET[n]?>,<?=20*$n?>>
<?for($i=0;$i<$n;$i++)
echo"<rect x=0 y=".($y=$i*20)." fill=none width=$w height=20 stroke=grey />
<text x=5 y=".($y+17).">$i</text>
<path d=M".($x=$i*10+25).",".($y+17)."L$x,".($m=($i*10%$n)*20+5)." fill=none stroke=blue />
<circle cx=$x cy=$m r=2 fill=#0f0 />"?>
</svg>

output for n=72

<svg viewBox=0,0,750,1440><rect x=0 y=0 fill=none width=750 height=20 stroke=grey /><text x=5 y=17>0</text><path d=M25,17L25,5 fill=none stroke=blue /><circle cx=25 cy=5 r=2 fill=#0f0 /><rect x=0 y=20 fill=none width=750 height=20 stroke=grey /><text x=5 y=37>1</text><path d=M35,37L35,205 fill=none stroke=blue /><circle cx=35 cy=205 r=2 fill=#0f0 /><rect x=0 y=40 fill=none width=750 height=20 stroke=grey /><text x=5 y=57>2</text><path d=M45,57L45,405 fill=none stroke=blue /><circle cx=45 cy=405 r=2 fill=#0f0 /><rect x=0 y=60 fill=none width=750 height=20 stroke=grey /><text x=5 y=77>3</text><path d=M55,77L55,605 fill=none stroke=blue /><circle cx=55 cy=605 r=2 fill=#0f0 /><rect x=0 y=80 fill=none width=750 height=20 stroke=grey /><text x=5 y=97>4</text><path d=M65,97L65,805 fill=none stroke=blue /><circle cx=65 cy=805 r=2 fill=#0f0 /><rect x=0 y=100 fill=none width=750 height=20 stroke=grey /><text x=5 y=117>5</text><path d=M75,117L75,1005 fill=none stroke=blue /><circle cx=75 cy=1005 r=2 fill=#0f0 /><rect x=0 y=120 fill=none width=750 height=20 stroke=grey /><text x=5 y=137>6</text><path d=M85,137L85,1205 fill=none stroke=blue /><circle cx=85 cy=1205 r=2 fill=#0f0 /><rect x=0 y=140 fill=none width=750 height=20 stroke=grey /><text x=5 y=157>7</text><path d=M95,157L95,1405 fill=none stroke=blue /><circle cx=95 cy=1405 r=2 fill=#0f0 /><rect x=0 y=160 fill=none width=750 height=20 stroke=grey /><text x=5 y=177>8</text><path d=M105,177L105,165 fill=none stroke=blue /><circle cx=105 cy=165 r=2 fill=#0f0 /><rect x=0 y=180 fill=none width=750 height=20 stroke=grey /><text x=5 y=197>9</text><path d=M115,197L115,365 fill=none stroke=blue /><circle cx=115 cy=365 r=2 fill=#0f0 /><rect x=0 y=200 fill=none width=750 height=20 stroke=grey /><text x=5 y=217>10</text><path d=M125,217L125,565 fill=none stroke=blue /><circle cx=125 cy=565 r=2 fill=#0f0 /><rect x=0 y=220 fill=none width=750 height=20 stroke=grey /><text x=5 y=237>11</text><path d=M135,237L135,765 fill=none stroke=blue /><circle cx=135 cy=765 r=2 fill=#0f0 /><rect x=0 y=240 fill=none width=750 height=20 stroke=grey /><text x=5 y=257>12</text><path d=M145,257L145,965 fill=none stroke=blue /><circle cx=145 cy=965 r=2 fill=#0f0 /><rect x=0 y=260 fill=none width=750 height=20 stroke=grey /><text x=5 y=277>13</text><path d=M155,277L155,1165 fill=none stroke=blue /><circle cx=155 cy=1165 r=2 fill=#0f0 /><rect x=0 y=280 fill=none width=750 height=20 stroke=grey /><text x=5 y=297>14</text><path d=M165,297L165,1365 fill=none stroke=blue /><circle cx=165 cy=1365 r=2 fill=#0f0 /><rect x=0 y=300 fill=none width=750 height=20 stroke=grey /><text x=5 y=317>15</text><path d=M175,317L175,125 fill=none stroke=blue /><circle cx=175 cy=125 r=2 fill=#0f0 /><rect x=0 y=320 fill=none width=750 height=20 stroke=grey /><text x=5 y=337>16</text><path d=M185,337L185,325 fill=none stroke=blue /><circle cx=185 cy=325 r=2 fill=#0f0 /><rect x=0 y=340 fill=none width=750 height=20 stroke=grey /><text x=5 y=357>17</text><path d=M195,357L195,525 fill=none stroke=blue /><circle cx=195 cy=525 r=2 fill=#0f0 /><rect x=0 y=360 fill=none width=750 height=20 stroke=grey /><text x=5 y=377>18</text><path d=M205,377L205,725 fill=none stroke=blue /><circle cx=205 cy=725 r=2 fill=#0f0 /><rect x=0 y=380 fill=none width=750 height=20 stroke=grey /><text x=5 y=397>19</text><path d=M215,397L215,925 fill=none stroke=blue /><circle cx=215 cy=925 r=2 fill=#0f0 /><rect x=0 y=400 fill=none width=750 height=20 stroke=grey /><text x=5 y=417>20</text><path d=M225,417L225,1125 fill=none stroke=blue /><circle cx=225 cy=1125 r=2 fill=#0f0 /><rect x=0 y=420 fill=none width=750 height=20 stroke=grey /><text x=5 y=437>21</text><path d=M235,437L235,1325 fill=none stroke=blue /><circle cx=235 cy=1325 r=2 fill=#0f0 /><rect x=0 y=440 fill=none width=750 height=20 stroke=grey /><text x=5 y=457>22</text><path d=M245,457L245,85 fill=none stroke=blue /><circle cx=245 cy=85 r=2 fill=#0f0 /><rect x=0 y=460 fill=none width=750 height=20 stroke=grey /><text x=5 y=477>23</text><path d=M255,477L255,285 fill=none stroke=blue /><circle cx=255 cy=285 r=2 fill=#0f0 /><rect x=0 y=480 fill=none width=750 height=20 stroke=grey /><text x=5 y=497>24</text><path d=M265,497L265,485 fill=none stroke=blue /><circle cx=265 cy=485 r=2 fill=#0f0 /><rect x=0 y=500 fill=none width=750 height=20 stroke=grey /><text x=5 y=517>25</text><path d=M275,517L275,685 fill=none stroke=blue /><circle cx=275 cy=685 r=2 fill=#0f0 /><rect x=0 y=520 fill=none width=750 height=20 stroke=grey /><text x=5 y=537>26</text><path d=M285,537L285,885 fill=none stroke=blue /><circle cx=285 cy=885 r=2 fill=#0f0 /><rect x=0 y=540 fill=none width=750 height=20 stroke=grey /><text x=5 y=557>27</text><path d=M295,557L295,1085 fill=none stroke=blue /><circle cx=295 cy=1085 r=2 fill=#0f0 /><rect x=0 y=560 fill=none width=750 height=20 stroke=grey /><text x=5 y=577>28</text><path d=M305,577L305,1285 fill=none stroke=blue /><circle cx=305 cy=1285 r=2 fill=#0f0 /><rect x=0 y=580 fill=none width=750 height=20 stroke=grey /><text x=5 y=597>29</text><path d=M315,597L315,45 fill=none stroke=blue /><circle cx=315 cy=45 r=2 fill=#0f0 /><rect x=0 y=600 fill=none width=750 height=20 stroke=grey /><text x=5 y=617>30</text><path d=M325,617L325,245 fill=none stroke=blue /><circle cx=325 cy=245 r=2 fill=#0f0 /><rect x=0 y=620 fill=none width=750 height=20 stroke=grey /><text x=5 y=637>31</text><path d=M335,637L335,445 fill=none stroke=blue /><circle cx=335 cy=445 r=2 fill=#0f0 /><rect x=0 y=640 fill=none width=750 height=20 stroke=grey /><text x=5 y=657>32</text><path d=M345,657L345,645 fill=none stroke=blue /><circle cx=345 cy=645 r=2 fill=#0f0 /><rect x=0 y=660 fill=none width=750 height=20 stroke=grey /><text x=5 y=677>33</text><path d=M355,677L355,845 fill=none stroke=blue /><circle cx=355 cy=845 r=2 fill=#0f0 /><rect x=0 y=680 fill=none width=750 height=20 stroke=grey /><text x=5 y=697>34</text><path d=M365,697L365,1045 fill=none stroke=blue /><circle cx=365 cy=1045 r=2 fill=#0f0 /><rect x=0 y=700 fill=none width=750 height=20 stroke=grey /><text x=5 y=717>35</text><path d=M375,717L375,1245 fill=none stroke=blue /><circle cx=375 cy=1245 r=2 fill=#0f0 /><rect x=0 y=720 fill=none width=750 height=20 stroke=grey /><text x=5 y=737>36</text><path d=M385,737L385,5 fill=none stroke=blue /><circle cx=385 cy=5 r=2 fill=#0f0 /><rect x=0 y=740 fill=none width=750 height=20 stroke=grey /><text x=5 y=757>37</text><path d=M395,757L395,205 fill=none stroke=blue /><circle cx=395 cy=205 r=2 fill=#0f0 /><rect x=0 y=760 fill=none width=750 height=20 stroke=grey /><text x=5 y=777>38</text><path d=M405,777L405,405 fill=none stroke=blue /><circle cx=405 cy=405 r=2 fill=#0f0 /><rect x=0 y=780 fill=none width=750 height=20 stroke=grey /><text x=5 y=797>39</text><path d=M415,797L415,605 fill=none stroke=blue /><circle cx=415 cy=605 r=2 fill=#0f0 /><rect x=0 y=800 fill=none width=750 height=20 stroke=grey /><text x=5 y=817>40</text><path d=M425,817L425,805 fill=none stroke=blue /><circle cx=425 cy=805 r=2 fill=#0f0 /><rect x=0 y=820 fill=none width=750 height=20 stroke=grey /><text x=5 y=837>41</text><path d=M435,837L435,1005 fill=none stroke=blue /><circle cx=435 cy=1005 r=2 fill=#0f0 /><rect x=0 y=840 fill=none width=750 height=20 stroke=grey /><text x=5 y=857>42</text><path d=M445,857L445,1205 fill=none stroke=blue /><circle cx=445 cy=1205 r=2 fill=#0f0 /><rect x=0 y=860 fill=none width=750 height=20 stroke=grey /><text x=5 y=877>43</text><path d=M455,877L455,1405 fill=none stroke=blue /><circle cx=455 cy=1405 r=2 fill=#0f0 /><rect x=0 y=880 fill=none width=750 height=20 stroke=grey /><text x=5 y=897>44</text><path d=M465,897L465,165 fill=none stroke=blue /><circle cx=465 cy=165 r=2 fill=#0f0 /><rect x=0 y=900 fill=none width=750 height=20 stroke=grey /><text x=5 y=917>45</text><path d=M475,917L475,365 fill=none stroke=blue /><circle cx=475 cy=365 r=2 fill=#0f0 /><rect x=0 y=920 fill=none width=750 height=20 stroke=grey /><text x=5 y=937>46</text><path d=M485,937L485,565 fill=none stroke=blue /><circle cx=485 cy=565 r=2 fill=#0f0 /><rect x=0 y=940 fill=none width=750 height=20 stroke=grey /><text x=5 y=957>47</text><path d=M495,957L495,765 fill=none stroke=blue /><circle cx=495 cy=765 r=2 fill=#0f0 /><rect x=0 y=960 fill=none width=750 height=20 stroke=grey /><text x=5 y=977>48</text><path d=M505,977L505,965 fill=none stroke=blue /><circle cx=505 cy=965 r=2 fill=#0f0 /><rect x=0 y=980 fill=none width=750 height=20 stroke=grey /><text x=5 y=997>49</text><path d=M515,997L515,1165 fill=none stroke=blue /><circle cx=515 cy=1165 r=2 fill=#0f0 /><rect x=0 y=1000 fill=none width=750 height=20 stroke=grey /><text x=5 y=1017>50</text><path d=M525,1017L525,1365 fill=none stroke=blue /><circle cx=525 cy=1365 r=2 fill=#0f0 /><rect x=0 y=1020 fill=none width=750 height=20 stroke=grey /><text x=5 y=1037>51</text><path d=M535,1037L535,125 fill=none stroke=blue /><circle cx=535 cy=125 r=2 fill=#0f0 /><rect x=0 y=1040 fill=none width=750 height=20 stroke=grey /><text x=5 y=1057>52</text><path d=M545,1057L545,325 fill=none stroke=blue /><circle cx=545 cy=325 r=2 fill=#0f0 /><rect x=0 y=1060 fill=none width=750 height=20 stroke=grey /><text x=5 y=1077>53</text><path d=M555,1077L555,525 fill=none stroke=blue /><circle cx=555 cy=525 r=2 fill=#0f0 /><rect x=0 y=1080 fill=none width=750 height=20 stroke=grey /><text x=5 y=1097>54</text><path d=M565,1097L565,725 fill=none stroke=blue /><circle cx=565 cy=725 r=2 fill=#0f0 /><rect x=0 y=1100 fill=none width=750 height=20 stroke=grey /><text x=5 y=1117>55</text><path d=M575,1117L575,925 fill=none stroke=blue /><circle cx=575 cy=925 r=2 fill=#0f0 /><rect x=0 y=1120 fill=none width=750 height=20 stroke=grey /><text x=5 y=1137>56</text><path d=M585,1137L585,1125 fill=none stroke=blue /><circle cx=585 cy=1125 r=2 fill=#0f0 /><rect x=0 y=1140 fill=none width=750 height=20 stroke=grey /><text x=5 y=1157>57</text><path d=M595,1157L595,1325 fill=none stroke=blue /><circle cx=595 cy=1325 r=2 fill=#0f0 /><rect x=0 y=1160 fill=none width=750 height=20 stroke=grey /><text x=5 y=1177>58</text><path d=M605,1177L605,85 fill=none stroke=blue /><circle cx=605 cy=85 r=2 fill=#0f0 /><rect x=0 y=1180 fill=none width=750 height=20 stroke=grey /><text x=5 y=1197>59</text><path d=M615,1197L615,285 fill=none stroke=blue /><circle cx=615 cy=285 r=2 fill=#0f0 /><rect x=0 y=1200 fill=none width=750 height=20 stroke=grey /><text x=5 y=1217>60</text><path d=M625,1217L625,485 fill=none stroke=blue /><circle cx=625 cy=485 r=2 fill=#0f0 /><rect x=0 y=1220 fill=none width=750 height=20 stroke=grey /><text x=5 y=1237>61</text><path d=M635,1237L635,685 fill=none stroke=blue /><circle cx=635 cy=685 r=2 fill=#0f0 /><rect x=0 y=1240 fill=none width=750 height=20 stroke=grey /><text x=5 y=1257>62</text><path d=M645,1257L645,885 fill=none stroke=blue /><circle cx=645 cy=885 r=2 fill=#0f0 /><rect x=0 y=1260 fill=none width=750 height=20 stroke=grey /><text x=5 y=1277>63</text><path d=M655,1277L655,1085 fill=none stroke=blue /><circle cx=655 cy=1085 r=2 fill=#0f0 /><rect x=0 y=1280 fill=none width=750 height=20 stroke=grey /><text x=5 y=1297>64</text><path d=M665,1297L665,1285 fill=none stroke=blue /><circle cx=665 cy=1285 r=2 fill=#0f0 /><rect x=0 y=1300 fill=none width=750 height=20 stroke=grey /><text x=5 y=1317>65</text><path d=M675,1317L675,45 fill=none stroke=blue /><circle cx=675 cy=45 r=2 fill=#0f0 /><rect x=0 y=1320 fill=none width=750 height=20 stroke=grey /><text x=5 y=1337>66</text><path d=M685,1337L685,245 fill=none stroke=blue /><circle cx=685 cy=245 r=2 fill=#0f0 /><rect x=0 y=1340 fill=none width=750 height=20 stroke=grey /><text x=5 y=1357>67</text><path d=M695,1357L695,445 fill=none stroke=blue /><circle cx=695 cy=445 r=2 fill=#0f0 /><rect x=0 y=1360 fill=none width=750 height=20 stroke=grey /><text x=5 y=1377>68</text><path d=M705,1377L705,645 fill=none stroke=blue /><circle cx=705 cy=645 r=2 fill=#0f0 /><rect x=0 y=1380 fill=none width=750 height=20 stroke=grey /><text x=5 y=1397>69</text><path d=M715,1397L715,845 fill=none stroke=blue /><circle cx=715 cy=845 r=2 fill=#0f0 /><rect x=0 y=1400 fill=none width=750 height=20 stroke=grey /><text x=5 y=1417>70</text><path d=M725,1417L725,1045 fill=none stroke=blue /><circle cx=725 cy=1045 r=2 fill=#0f0 /><rect x=0 y=1420 fill=none width=750 height=20 stroke=grey /><text x=5 y=1437>71</text><path d=M735,1437L735,1245 fill=none stroke=blue /><circle cx=735 cy=1245 r=2 fill=#0f0 /></svg>

Python 2, 540 464 431 bytes
Some golfing like using shorter variable names, variable substitution, list comprehension and changing everything to white (except the text).
Biggest save was changing precomputed positions to dynamically (see L).
from cv2 import*
from numpy import*
D=1024
G=zeros((D,D,3),uint8)
n=7
w=(1,1,1)
R=range(n)
c=circle
I=int
L=lambda i,r=400:(I(sin(2*pi*i/n)*r+D/2),I(D/2-cos(2*pi*i/n)*r))
for i in R:
 p,q=L(i),L((i*10)%n)
 line(G,p,L((i+1)%n),w,5)
 line(G,p,q,w,5)
 f=lambda z:I(.15*p[z]+.85*q[z])
 c(G,[(f(0),f(1)),L(i,450)][p==q],25,w,-1)
for i in R:
 c(G,L(i),50,w,-1)
 putText(G,`i`,(L(i)[0]-30,L(i)[1]+30),0,2,(0,0,0),2)
imwrite('m.png',G*255)

L calculates the positions of the circles by distance to origin for the big ones containing the numbers and the outer small ones that indicate self pointing.
First loop draws the connections: 1st line is the circle around and 2nd line is in the interior, a small circle is added to show direction or self pointing.
Second loop puts big circle and number.
It is obviously not as nice as the Mathematica answers, but everything made from scratch.

Mathematica, 124 121 bytes
Graph[Join@@Thread[{k->Mod[k+1,#],k->Mod[10k,#]}~Table~{k,0,#-1}],VertexLabels->"Name",GraphLayout->"CircularEmbedding"]&

Creates a figure as a graph with directed edges. The graph output now follows the same pattern except counter-clockwise. I prefer Greg Martin's solution a lot more since the output is much more aesthetically pleasing.
A less visually pleasant graph can be generated for 82 bytes using
Graph[Join@@({k->Mod[k+1,#],k->Mod[10k,#]}~Table~{k,0,#-1}),VertexLabels->"Name"]&

For d = 8,

Yeah, I wanted to use Graph but had the same negative reaction. Also, for the algorithm it's important to distinguish between the "clockwise" edges and the "times 10" edges. I'm sure there are options for Graph that handle that—but then, here come more bytes....

@GregMartin I was reading through more Graph features and found tricks like using -> instead of DirectedEdge. I shortened that initial 100 byte version to 82 bytes, but then correcting it to be in the right format added another 42 bytes.

That's interesting: I tried CircularEmbedding, but it didn't put the vertices in clockwise order for n=7 (I admit I didn't try other inputs). Does it work for you with n=7?

It seems to depend on the order of the edges in the input list. I used Join and Transpose so that the outside edges would be listed first before the interior edges. The vertices are ordered correctly along a circular path, but since the edges prefer to be straight, it ends up resembling an n-gon.

Python 2 + graphviz, 147 bytes
from graphviz import*
d=Digraph()
k=input()
p=d.edge
for j in[d.node(`i`,`i`)or i for i in range(k)]:
 p(`j`,`-~j%k`);p(`j`,`10*j%k`)
d.render("o")

Doesn't always draw a circle, outputs a pdf file called o

Haskell, 350 bytes
Inspired by @Loovjo, I also use ASCII art. This works for numbers under 100000 (or something like that).
g k="\t"++(foldl (++) ""$map (\y->show y++"|") [0..k])
n k=length$g k
r z x=(show x)++":\t"++(replicate f ' ')++(replicate d s)++"\n" where y=mod (x*10) z;(a,b)=(min x y,max x y);s=(case compare y x of LT->'<';EQ->'.';GT->'>');f=n (a-1)-1;d=n b-f-2
w z=(g (z-1))++"\n"++(foldl1 (++) (map (r z) [0..(z-1)]))
main=do{n<-getLine;putStrLn (w$read n);}

Basically you point from x to (x*10)%n.
You can try this here. But since codepad doesn't support input, change q to the value of n you want, and resubmit. (Note that forking doesn't work, so copy and resubmit from main page). The code submitted there is a bit different, because the above version takes input from console.
I hope the output is intuitive. Compression suggestions are welcome (particularly if that beats 294 ;)).

Welcome to PPCG! Nice first post!

You can remove a lot of spaces, such as the ones in foldl (++) ""$map (\...

Batch, 394 bytes
@echo off
set/an=%1-1
set s=
for /l %%j in (0,1,%n%)do call:h %%j
echo %s%
for /l %%i in (0,1,%n%)do call:r %%i %1
exit/b
:h
set "s=%s%^>%1^>"
exit/b
:r
set/ar=%1*10%%%2
set s=
for /l %%j in (0,1,%n%)do call:l %%j %1
echo %s%
exit/b
:l
if %1==%r% set "s=%s%^>%1^<"&exit/b
if %2 geq %1 if %1 geq %r% set "s=%s%^<%1%^<"&exit/b
if %2 leq %1 if %1 leq %r% goto h
set "s=%s% %1 "

Escaping in Batch is ugly at the best of times. Example output for 7:
>0>>1>>2>>3>>4>>5>>6>
>0< 1  2  3  4  5  6
 0 >1>>2>>3< 4  5  6
 0  1 >2>>3>>4>>5>>6<
 0  1 >2<<3< 4  5  6
 0  1  2  3 >4>>5< 6
 0 >1<<2<<3<<4<<5< 6
 0  1  2  3 >4<<5<<6<

What kind of image does this output? This challenge is graphical-output.

@mbomb007 How's this for output? The >0< shows that 0 maps to itself, while >2<<<3< shows that 3 maps to 2.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Ghosts and Pumpkins
Here's an ASCII pumpkin carved into a Jack-o-Lantern. Isn't it cute?
((^v^))

Here's an ASCII ghost. Look how spooky it is!
\{O.O}/

Obviously, the pumpkins have to be on the ground, with a space between them so they don't rot.
Ghosts, however, like to stand on top of pumpkins, so they're even spookier. However, they have to stand on two pumpkins, else their ghostly weight will crush the pumpkin beneath them. But, due to how their ghostly magic works, multiple ghosts can stack and share pumpkins, provided that the ghosts are either split evenly on the lower pumpkins or the lower ghosts. In other words, forming a shape like a human pyramid. Note that ghosts can't stack on ghosts unless there's a pumpkin underneath (that's how the magic works).
Given two non-negative integers, g and p, representing the number of ghosts and pumpkins, output the most-compact left-most formation possible, following the above pyramid stacking rules. Leftover pumpkins and ghosts (that is, those not forming the pyramid) go on the ground to the right.
For clarification, these formations are OK (blank newline separated), and serve as example I/O:
0p 1g
\{O.O}/

1p 0g
((^v^))

1p 1g
((^v^)) \{O.O}/

2p 1g
    \{O.O}/
((^v^)) ((^v^))

2p 2g
    \{O.O}/
((^v^)) ((^v^)) \{O.O}/

3p 1g
    \{O.O}/
((^v^)) ((^v^)) ((^v^))

3p 2g
    \{O.O}/ \{O.O}/
((^v^)) ((^v^)) ((^v^))

3p 3g
        \{O.O}/
    \{O.O}/ \{O.O}/
((^v^)) ((^v^)) ((^v^))

0p 4g
\{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/

3p 0g
((^v^)) ((^v^)) ((^v^))

7p 6g
            \{O.O}/
        \{O.O}/ \{O.O}/
    \{O.O}/ \{O.O}/ \{O.O}/
((^v^)) ((^v^)) ((^v^)) ((^v^)) ((^v^)) ((^v^)) ((^v^))

These formations are Not OK
\{O.O}/
((^v^))

    \{O.O}/
((^v^))

((^v^)) ((^v^)) \{O.O}/

    \{O.O}/
    \{O.O}/
((^v^)) ((^v^))

            \{O.O}/
\{O.O}/ ((^v^)) ((^v^))

    ((^v^))
((^v^)) ((^v^))

      \{O.O}/
((^v^)) ((^v^))

Input
Two non-negative integers in any convenient format. At least one of the numbers will be non-zero. You can take the inputs in either order (i.e., in the examples I had pumpkins first) -- please specify how you take input in your answer.
Output
An ASCII-art representation of the ghosts and pumpkins, following the above rules. Leading/trailing newlines or other whitespace are optional, provided that the ghosts and pumpkins line up appropriately.
Rules

Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

What's the correct formation for 7 pumpkins and 6 ghosts?

@Neil Since the rules ask for the most-compact left-most output, that would be a pyramid of 6 ghosts on top of 4 pumpkins, with an additional 3 pumpkins to the right. I'll add it as an example.

Well, your use of compact confused me - I could put all the ghosts on the same row, so that's more compact vertically!

Will pumpkins always be provided before ghosts?

@GabrielBenamy Your choice. If it makes your code easier to do ghosts then pumpkins, go for that. Please specify which way you take the input.

@TimmyD I missed that section, sorry.

I like that the ghosts and pumpkins are making a human pyramid

JavaScript (ES7), 166 164 159 bytes
Saved 5 bytes thanks to Neil
f=(p,g,j=(g*2)**.5+.5|0,G=j>p-1?p?p-1:0:j,P=`
`,i=~j?g-G*++G/2:G,n=i>0?i>g?g:i:0)=>p|g?f(0,g-n,-1,G-1,P+'    ')+P+'((^v^)) '.repeat(p)+'\\{O.O}/ '.repeat(n):''

Formatted and commented
f = (                                    // given:
  p,                                     // - p = number of pumpkins
  g,                                     // - g = number of ghosts
  j = (g * 2) ** .5 + .5 | 0,            // - j = ceil(triangular root of g)
  G = j > p - 1 ? p ? p - 1 : 0 : j,     // - G = max(0, min(p - 1, j))
  P = '\n',                              // - P = padding string (+ line-break)
  i = ~j ?                               // - i =
    g - G * ++G / 2                      //   first iteration: g - G * (G + 1) / 2
  : G,                                   //   next iterations: G
  n = i > 0 ? i > g ? g : i : 0          // - n = max(0, min(i, g)) = number of
) =>                                     //   ghosts to print at this iteration
p | g ?                                  // if there's still something to print:
  f(                                     //   do a recursive call with:
    0,                                   //   - no pumpkin anymore
    g - n,                               //   - the updated number of ghosts
    -1,                                  //   - j = -1 (so that ~j == 0)
    G - 1,                               //   - one less ghost on the pyramid row
    P + '    '                           //   - updated padding string
  ) +                                    //
  P +                                    //   append padding string
  '((^v^)) '.repeat(p) +                 //   append pumpkins
  '\\{O.O}/ '.repeat(n)                  //   append ghosts
: ''                                     // else: stop

Underlying math
The tricky part is to find out the optimal width G of the ghost pyramid.
The number of ghosts g in such a pyramid is given by:
g = 1 + 2 + 3 + ... + G = G(G + 1) / 2

Reciprocally, the width of a pyramid containing g ghosts is the real root of the resulting quadratic equation:
G² + G - 2g = 0

Δ = 1² - 4(-2g)
Δ = 8g + 1

G = (-1 ± √Δ) / 2

Which leads to the following real root (also known as the triangular root):
G = (√(8g + 1) - 1) / 2

However, the width of the pyramid is also limited by the number of pumpkins: we can have no more than p-1 ghosts over p pumpkins. Hence the final formula used in the code:
j = ⌈(√(8g + 1) - 1) / 2⌉
G = max(0, min(p - 1, j))

ES6 version, 173 171 166 bytes
f=(p,g,j=Math.pow(g*2,.5)+.5|0,G=j>p-1?p?p-1:0:j,P=`
`,i=~j?g-G*++G/2:G,n=i>0?i>g?g:i:0)=>p|g?f(0,g-n,-1,G-1,P+'    ')+P+'((^v^)) '.repeat(p)+'\\{O.O}/ '.repeat(n):''

Test cases (ES6)

f=(p,g,j=Math.pow(g*2,.5)+.5|0,G=j>p-1?p?p-1:0:j,P=`
`,i=~j?g-G*++G/2:G,n=i>0?i>g?g:i:0)=>p|g?f(0,g-n,-1,G-1,P+'    ')+P+'((^v^)) '.repeat(p)+'\\{O.O}/ '.repeat(n):''

console.log(f(0, 1));
console.log(f(1, 0));
console.log(f(1, 1));
console.log(f(2, 1));
console.log(f(2, 2));
console.log(f(3, 1));
console.log(f(3, 2));
console.log(f(3, 3));
console.log(f(0, 4));
console.log(f(3, 0));
console.log(f(7, 6));

I think j=(g+g)**.5+.5|0 should work.

Nice explanation!

@Neil This is shorter and more reliable. (My method had some invalid values, starting at g = 5051.) Thanks.

Perl, 246 bytes (newlines are not part of the code and are provided solely for readability)
($c,$d)=<>=~/(\d+)/g;
$p="((^v^)) ";$g="\\{O.O}/ ";
for($f[0]=$c;$d>0;$d--){$f[$b+1]+1<$f[$b]?$f[++$b]++:$f[$b]++;$f[0]+=$d,$d=0 if$b==$c-1;$f[$b]==1?$b=0:1}
$h[0]=($p x$c).$g x($f[0]-$c);$h[$_].=$"x(4*$_).$g x$f[$_]for(1..$#f);
say join$/,reverse@h;

Accepts two numbers: pumpkins first, followed by ghosts.
Sample input:
5 20

Sample output:
                \{O.O}/
            \{O.O}/ \{O.O}/
        \{O.O}/ \{O.O}/ \{O.O}/
    \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/
((^v^)) ((^v^)) ((^v^)) ((^v^)) ((^v^)) \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/ \{O.O}/

Oh, you read my wording a little different than how I was intending -- Ghosts can only stack on top of ghosts if there's a pumpkin underneath, otherwise they need to go to the right single-file. That's why the 0p 4g test case has all the ghosts in a line, rather than stacked.

@TimmyD Alright, I fixed it now.  I'll need to do a bit of golfing to reduce it though.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Pythagorean Triple Sequence

A Pythagorean triple consists of three positive integers a, b, and c, such that a2 + b2 = c2. Such a triple is commonly written (a, b, c), and a well-known example is (3, 4, 5). If (a, b, c) is a Pythagorean triple, then so is (ka, kb, kc) for any positive integer k. A primitive Pythagorean triple is one in which a, b and c are coprime.

Using this knowledge, we can create a sequence by chaining together the least lengths of triples, where the next element in the sequence is the hypotenuse (largest number) of the smallest primitive Pythagorean triple containing the previous element as the smallest one of its lengths.
Start with the smallest primitive Pythagorean triple (3, 4, 5). The sequence begins with 3, and the hypotenuse (next element in the sequence) is 5. Then find the smallest primitive Pythagorean triple with 5 as a leg, and you get (5, 12, 13). So the sequence continues with 13.
Either output the sequence forever, or take an integer input n and output the first n elements of the sequence, either zero or one indexed.
You need to support output at least through and including 28455997, but if the limit of the data type you are using was suddenly raised, it would need to work for that new limit. So you cannot hard code a list of numbers.
3
5
13
85
157
12325
90733
2449525
28455997
295742792965
171480834409967437
656310093705697045
1616599508725767821225590944157
4461691012090851100342993272805
115366949386695884000892071602798585632943213
12002377162350258332845595301471273220420939451301220405

OEIS A239381
Similar sequences (don't output these!):

A018928
A077034 (the odd terms)

Is there any time limit?

@Loovjo No, but you should know/prove that your output is correct. There are some similar sequences where the output differs after 12325.

The similar sequence I'm thinking of differs after 85... its next term is 3613 (can you guess what it is yet?)

@Neil A quick search yields A053630, the Pythagorean spiral. I referenced the two in the challenge though, because while working on making my implementation I accidentally reached those two sequences or similar to them.

Indeed, had I been more awake I could have just looked it up myself...

Jelly, 19 bytes
o3ṄÆF*/€ŒPP€²+Ṛ$HṂß

Saved a byte thanks to @Dennis by refactoring to an infinite sequence.
Takes no input and arguments, then outputs the sequence infinitely by printing each term as it computes them. This method slows down as the numbers get larger since it depends on prime factorization.
Try it online!
This calculates the next term by computing the prime power factorization of the current term. For 12325, this is {52, 17, 29}. There is a variant of Euclid's formula for calculating Pythagorean triples {a, b, c},

where m > n and the triple is primitive iff m and n are coprime.
To calculate the next primitive root from 12325, find m and n such that mn = 12325 and choose m,n so that gcd(m, n) = 1. Then generate all pairs of m,n by creating all subsets of {52, 17, 29} and finding the product of each of those subsets which are {1, 25, 17, 29, 425, 725, 493, 12325}. Then divide 12325 by each value and pair so that each pair is m,n. Compute the formula for c using each pair and take the minimum which is 90733.

The previous method failed for determining the next term after 228034970321525477033478437478475683098735674620405573717049066152557390539189785244849203205. The previous method chose the last value as a factor when the correct choice was the 3rd and last primes. The new method is slower but will always work since it tests all pairs of coprimes to find the minimal hypotenuse.

Explanation
o3ṄÆF*/€ŒPP€²+Ṛ$HṂß  Main link. Input: 0 if none, else an integer P
o3                   Logical OR with 3, returns P if non-zero else 3
  Ṅ                  Println and pass the value
   ÆF                Factor into [prime, exponent] pairs
     */€             Reduce each pair using exponentation to get the prime powers
        ŒP           Powerset of those
          P€         Product of each
            ²        Square each
               $     Monadic chain
             +         Add vectorized with
              Ṛ        the reverse
                H    Halve
                 Ṃ   Minimum
                  ß  Call recursively on this value

Wow, this is really fast!

o3ṄÆfµṪ,P²SHß with infinite output saves a byte.

Brachylog, 36 bytes
3{@wB:?>:^a+~^=C:B:?:{$pd}ac#d,C:1&}

Try it online!
You have to wait for the program to time out (1 minute) before TIO flushes the output. In SWI-Prolog's REPL this prints as soon as it finds the value.
This will print the sequence forever.
After a few minutes on the offline SWI-Prolog's interpreter, I obtained 90733 after 12325. I stopped it after this point.
This isn't complete bruteforce as it uses constraints to find pythagorean triples, though it is obviously not optimised for speed.
Explanation
3{                                 }    Call this predicate with 3 as Input
  @w                                    Write the Input followed by a line break
    B:?>                                B > Input
           +                            The sum...
        :^a                             ...of Input^2 with B^2...
            ~^                          ...must equal a number which is itself a square
              =C                        Assign a fitting value to that number and call it C
               C:B:?:{$pd}a             Get the lists of prime factors of C, B and Input
                                          without duplicates
                           c#d,         Concatenate into a single list; all values must be
                                          different
                               C:1&     Call recursively with C as Input

Perl, 73 bytes
for($_=3;$_<1e9;$_=$a**2+$b**2){$a++until($b=($_+$a**2)**.5)==($b|0);say}

All Pythagorean Triples a²+b²=c² satisfy a=r(m²-n²), b=2rmn, c=r(m²+n²) for some integers r,m,n.  When r=1 and m,n are coprime with exactly one being divisible by 2, then a,b,c is a primitive triple, where a,b,c are all pairwise coprime.
With this in mind, given some a, I use a brute-force algorithm to calculate the smallest n such that a²-n² is a square, namely m².  Then, c is equal to n²+m².

Possible typo in your explanation: you search for n such that a+n² is a square.

Racket 106 bytes
(let p((h 3))(println h)(let p2((i 1))(define g(sqrt(+(* h h)(* i i))))(if(integer? g)(p g)(p2(add1 i)))))

Ungolfed:
(define (f)
  (let loop ((h 3))
    (let loop2 ((i 1))
      (define g (sqrt (+(* h h) (* i i))))
      (if (not(integer? g))
          (loop2 (add1 i))
          (begin (printf "~a ~a ~a~n" h i g)
                 (loop g))))))

Testing:
(f)

Output of golfed version:
3
5
13
85
157
12325
12461
106285
276341
339709
10363909
17238541

Output of ungolfed version:
3 4 5
5 12 13
13 84 85
85 132 157
157 12324 12325
12325 1836 12461
12461 105552 106285
106285 255084 276341
276341 197580 339709
339709 10358340 10363909
10363909 13775220 17238541

(Error after this on my machine)

The golfed code prints out only hypotenuse of sequence. Ungolfed versions shows all three to clarify triplets not mentioned in question.

Python 3, 178 bytes
from math import*
p,n=[3,5],int(input())
while len(p)<n:
 for i in range(p[-1],p[-1]**2):
  v=sqrt(i**2+p[-1]**2)
  if v==int(v)and gcd(i,p[-1])==1:
   p+=[int(v)];break
print(p)

This is basically just a brute force algorithm, and thus is very slow. It takes the amount of terms to output as the input.
I'm not 100% sure about the correctness of this algorithm, the program checks for the other leg up to the first leg squared, which I believe is enough, but I haven't done the math.
Try it on repl.it! (Outdated) (Please don't try it for numbers greater than 10, it will be very slow)

You can switch to Python 3.5 and use math.gcd. Also, use p+=[...] instead of p.append(...). And <2 instead of ==1. And the if can all be on one line.

You can still do the last 2 improvements I suggested.

161 bytes

Loovjo, you gonna golf your code using the suggestions or not?

MATL, 27 bytes
Ii:"`I@Yyt1\~?3MZdZdq]}6MXI

This produces the first terms of the sequence. Input is 0-based.
The code is very inefficient. The online compiler times out for inputs greater than 5. Input 6 took a minute and a half offline (and produced the correct 90733 as 6-th term).
Try it online!
I            % Push 3 (predefined value of clipboard I)
i            % Input n
:"           % For each (i.e. execute n times)
  `          %   Do...while
    I        %     Push clipboard I. This is the latest term of the sequence
    @        %     Push iteration index, starting at 1
    Yy       %     Hypotenuse of those two values
    t1\      %     Duplicate. Decimal part
    ~?       %     If it is zero: we may have found the next term. But we still
             %     need to test for co-primality
      3M     %       Push the two inputs of the latest call to the hypotenuse
             %       function. The stack now contains the hypotenuse and the
             %       two legs
      ZdZd   %       Call GCD twice, to obtain the GCD of those three numbers
      q      %       Subtract 1. If the three numbers were co-prime this gives
             %       0, so the do...while loop will be exited (but the "finally"
             %       part will be executed first). If they were not co-prime
             %       this gives non-zero, so the do...while loop proceeds
             %       with the next iteration
    ]        %     End if
             %     If the decimal part was non-zero: the duplicate of the
             %     hypotenuse that is now on the top of the stack will be used
             %     as the (do...while) loop condition. Since it is non-zero,
             %     the loop will proceed with the next iteration
  }          %   Finally (i.e. execute before exiting the do...while loop)
    6M       %     Push the second input to the hypotenuse function, which is
             %     the new term of the sequence
    XI       %     Copy this new term into clipboard I
             %   Implicitly end do...while
             % Implicitly end for each
             % Implicitly display the stack, containing the sequence terms

Wolfram Language (Mathematica), 74 bytes
Nest[c/.#&@@Solve[{#^2+b^2==c^2,#<b<c&&GCD[b,c]==1},{b,c},Integers]&,3,#]&

Try it online!

Wolfram Language (Mathematica), 74 bytes
Nest[#&@@Cases[Divisors@#,d_/;GCD[d,#/d]<2&&d^2>#:>(d^2+(#/d)^2)/2]&,3,#]&

Try it online!

PHP, 139 bytes
for($k=3;$i=$k,print("$k\n");)for($j=$i+1;($k=sqrt($m=$i*$i+$j*$j))>(int)$k||gmp_intval(gmp_gcd(gmp_gcd((int)$i,(int)$j),(int)$k))>1;$j++);

The above code breaks after 28455997 on 32-bit systems. If higher numbers are needed, it becomes 156 bytes:
for($k=3;$i=$k,print("$k\n");)for($j=$i+1;!gmp_perfect_square($m=bcadd(bcpow($i,2),bcpow($j,2)))||gmp_intval(gmp_gcd(gmp_gcd($i,$j),$k=bcsqrt($m)))>1;$j++);

Java 8, 133 Bytes
-25 bytes thanks to miles Using n*n instead of Math.pow(n, 2)
-24 bytes thanks to miles Using for loops instead of while, changing datatype, eliminating () due to order of operations
()->{long b=3,c,n;for(;;){for(n=1;;n++){c=b+2*n*n;double d=Math.sqrt(c*c-b*b);if(d==(int)d&b<d){System.out.println(b);break;}}b=c;}};

Uses the fact that

for any pair of integers m > n > 0. Therefore, C is equal to A plus 2(N)2. The function above finds the least value of N that satisfies this relation, while making the second element of the Pythagorean triple an integer and greater than the first element. Then it sets the value of the first element to the third element and repeats with the updated first element.
Ungolfed:
void printPythagoreanTriples() {
    long firstElement = 3, thirdElement, n;
    while (true) {
        for (n = 1; ; n++) {
            thirdElement = firstElement + (2 * n * n);
            double secondElement = Math.sqrt(thirdElement * thirdElement - firstElement * firstElement);
            if (secondElement == (int) secondElement && firstElement < secondElement) {
                System.out.println("Found Pythagorean Triple [" +
                        firstElement + ", " +
                        secondElement + ", " +
                        thirdElement + "]");
                break;
            }
        }
        firstElement = thirdElement;
    }
}

Ideone it!
*The ideone does not print the last required element due to time limits, however as you can see through the logic of the program and the ungolfed version (which prints the 28455997 as the third element of the previous Pythagorean triple rather than the first element of the next), the values are, with a higher time limit, printed.

Couldn't you use n*n instead of Math.pow(n,2)?

I don't know why I didn't think of that... I'll add that right away. Thank you @miles

I shaved some more off using for loops to get it down to 133 bytes ()->{long b=3,c,n;for(;;){for(n=1;;n++){c=b+2*n*n;double d=Math.sqrt(c*c-b*b);if(d==(int)d&b<d){System.out.println(b);break;}}b=c;}};

Python 3.5, 97 bytes
Wrong output after 28455997, because of the limits of the floating point data type. The sqrt function isn't good enough, but if the precision was magically increased, it'd work.
Pretty simple to understand. Incrementing c by two instead of one cuts the runtime in half, and only odd numbers need to be checked anyway, because the elements are always odd.
import math
c=a=3
while 1:
	c+=2;b=(c*c-a*a)**.5;i=int(b)
	if math.gcd(a,i)<2<a<b==i:print(a);a=c

Try it online
The program cannot be run on Ideone, because Ideone uses Python 3.4

For output to stay accurate longer, I'd have to use decimal:
import math
from decimal import*
c=a=3
while 1:
	c+=2;b=Decimal(c*c-a*a).sqrt();i=int(b)
	if i==b>a>2>math.gcd(a,i):print(a);a=c

Try it online
To stay accurate indefinitely, I could do something horrid like this (increasing the precision required every single iteration:
import math
from decimal import*
c=a=3
while 1:
	c+=2;b=Decimal(c*c-a*a).sqrt();i=int(b);getcontext().prec+=1
	if i==b>a>2>math.gcd(a,i):print(a);a=c

J, 54 47 bytes
-:@+/@:*:@((*/:~)/)@,.&1@x:@(^/)@(2&p:)^:(<12)3

TIO
greedy split of prime factors into coprime factors
old 54 bytes TIO

Pari/GP, 71 bytes
n->a=3;for(i=1,n,a=[d^2+e^2|d<-divisors(a),gcd(d,e=a/d)<2&&d>e][1]/2);a

Try it online!

APL(NARS), 169 chars, 338 bytes
h←{{(m n)←⍵⋄(mm nn)←⍵*2⋄(2÷⍨nn+mm),(2÷⍨nn-mm),m×n}a⊃⍨b⍳⌊/b←{⍵[2]}¨a←a/⍨{(≤/⍵)∧1=∨/⍵}¨a←(w÷a),¨a←∪×/¨{k←≢b←1,π⍵⋄∪{b[⍵]}¨↑∪/101 1‼k k}w←⍵}⋄p←{⍺=1:⍵⋄⍵,(⍺-1)∇↑h ⍵}⋄q←{⍵p 3x}

test ok until 14 as argument of q:
  q 1
3
  q 2
3 5
  q 10
3 5 13 85 157 12325 90733 2449525 28455997 295742792965
  q 12
3 5 13 85 157 12325 90733 2449525 28455997 295742792965 171480834409967437 656310093705697045
  q 13
3 5 13 85 157 12325 90733 2449525 28455997 295742792965 171480834409967437 656310093705697045
  1616599508725767821225590944157
  q 14
NONCE ERROR
  q 14
  ∧

this below would find all divisors of its argument...
∪×/¨{k←≢b←1,π⍵⋄∪{b[⍵]}¨↑∪/101 1‼k k}

Husk, 14 bytes
m√¡ȯ`ḟİ□o£İ□-9

Try it online!
This times out after the fifth element, but it’s an infinite list.
m√¡ȯ`ḟİ□o£İ□-9
             9  Starting with 9
  ¡             Make an infinite list of legs^2 by applying this function repeatedly:
   ȯ`ḟİ□o£İ□-   This function finds the next leg, squared
    `ḟ          Find a number in
      İ□        The infinite list of perfect squares, such that
            -   It minus the previous leg^2 is
         £      An element of
          İ□    The infinite list of perfect squares
m               Then map each to
 √              Its square root

wow, it's even shorter now!

@Razetime Actually, I was counting the take 5 and parentheses earlier, so it was 14 bytes then too. I just can’t count :)

JavaScript (Node.js), 101 bytes
_=>{for(var a=3,b,c;;){for(c=1;;c++)if(b=a+2*c*c,d=Math.sqrt(b*b-a*a),d==+d&a<d){alert(a);break}a=b}}

Try it online!
Suggestions on golfing are welcome

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Find the Wavy Words!
(Note: this is an easier spin-off of my previous challenge Find the Infinity Words!, which is a spin-off of my other previous challenge Find the Swirling Words! :) )
Definition of a Wavy Word:

If you connect with curves all the characters of a Wavy Word on the alphabet (A-Z) you obtain the path of a wave continuously going toward right or toward left and never changing direction, like in the diagrams below.
A Wavy Word can be:

Raising if each consecutive character is at the right (on the alphabet) of the previous one.
Decreasing if each consecutive character is at the left (on the alphabet) of the previous one.

All the even connection must be down, all the odd connections must be up.
You can ignore upper/lowercase or consider/convert all to upper case or all to lower case.
The input words are only characters in the alphabet range of A-Z, no spaces, no punctuation, or symbols.
If a word has double characters, like "SPOON", you must collapse the doubles to one character: "SPOON" > "SPON" (because if you go from O to O is zero distance).
The Wavy Words will contain at least 3 distinct characters (even after doubles collapsing).

Here there are some examples:

Task:
Write a full program or function that will take a word from standard input and will output if it is a Wavy Word or not, and in positive case, output if it is raising or decreasing. The output can be True/False/Null, 2/1/0, 1/Null/0, -1/0/1, NO/WR/WD, etc, you decide how to represent it.
Test cases:
WAVY WORDS:
  ADEPT, BEGIN, BILL, BOSS, BOOST, CHIMP,
  KNOW, SPONGE, SPOON, TROLL, WOLF

ADEPT  > YES > RAISING
BEGIN  > YES > RAISING
BILL   > YES > RAISING
BOSS   > YES > RAISING
BOOST  > YES > RAISING
CHIMP  > YES > RAISING
KNOW   > YES > RAISING
SPONGE > YES > DECREASING
SPOON  > YES > DECREASING
TROLL  > YES > DECREASING
WOLF   > YES > DECREASING

NOT WAVY WORDS:
  WATCH, EARTH, NINON, FOO, BAR, WAVE, SELECTION,
  YES, NO, DEFINITION, WATER, WINE, CODE, AAAHHHH, I, MM, ABCA

Rules:

Shortest code wins.

Optional Task:
Find, as a list, as many Wavy Words as you can in an English dictionary, and the longest as well. You can take for example as reference the complete list of English words here.

How did you make the pictures?

@Oliver With Illustrator because I have it for work, but is possible to obtain similar results with Gimp or Inkskape, or others.

NO and FOO aren't valid inputs by your rules.

@Pietu1998 Yes because of the Definition #7

They're in the test cases though

@Pietu1998 They're in the NOT WAVY WORDS section though, which is correct..

@Shebang The spec says The input words will contain at least 3 distinct characters, not Wavy words will contain (...)

@Pietu1998 OK thanks for pointing that out, I clarified the Definition #7

Can you add a test case like ABCA which would wrongly pass the test if someone just removed duplicates instead of collapsing runs? (Sorry, I'm too lazy to come up with an actual word with that property right now.)

Do we have to validate whether rule 5 is satisfied for a word to be wavy? "The input words are only characters in the alphabet range of A-Z, no spaces, no punctuation, or symbols." I thought this was a promise on all inputs, but it's listed under "Definition of a Wavy Word". And, rule 7 requires three distinct letters, and there's non-wavy test cases of that.

Must there be a single output for each of the three cases?

@MartinEnder I added "ABCA" to the test cases since the code was edited by others adding more nonense words :)

@xnor #5 you can assume all the input words are as described, no need to validate. #7 this is the minimum number of letters to make a wave shape. For the rest you decide the output as you prefer.

I believe  rule 6 is a bad. Instead the line should bounce.

Can we expect that there are no words that consist of one character repeated? I.e.: Is AA or AAA possible input or not?

@Titus the input should be only real English words that you can find in a dictionary so I don't think that such cases exists (even though my question was edited adding nonsense words).

aa and aaa are in the list. No idea what they mean; but the answer to my question is No.

@Titus aa is a type of lava found in Hawaii, I think. Not sure about aaa.

05AB1E, 11 9 bytes (Thanks to Adnan)
Dg2›iÇü‹Ù

Try it online!
Wavy Cases:
0 - Decreasing Wavy
1 - Increasing Wavy
Not Wavy Cases:
[0,1] - Not wavy, initially decreasing, but then has an increase/equality that broke the pattern.
[1,0] - Not wavy, initially increasing, but then has a decrease/equality that broke the pattern
Input String - Not possible to be wavy in the first place due to length.
Explanation:
Dg2›iÇü‹Ù   # Full program

D           # Push 2 copies of input.
 g2›i       # If length is greater than 2.
     Ç      # Push ASCII values for all characters in the string.
      ü     # Push pairwise array.
       ‹    # Vectorize 1 if negative difference, 0 if positive difference.
        Ù   # Uniquify using right most unique values first.
            # Else just print the string back, letting them know it's not valid input.

@JonathanAllan Dangit... I just saw the comments and changes... I took The input words will contain at least 3 distinct characters to mean that I didn't have to handle less than 3 char words. Working on changes, may take awhile; this is my first answer I was able to do in 05AB1E.

@JonathanAllan Fixed :)! But now you're beating me ;).

Very nice! One tip, ü‹ is the same as ü-0‹ :)

Hehehe... Man, I may just have to learn python and start helping to expand 05AB1E. This language is impressive. Thanks for the tip!

Jelly, 10 bytes
OIṠḟ0µL’aQ

TryItOnline! or run all test cases
Returns:
[1] for wavy increasing
[-1] for wavy decreasing
something else otherwise ([], [0], [-1,1], or [1,-1])
(Declared as unnecessary: For a single value for each OIṠḟ0µL’aQS (11 bytes) will return 1, -1, and 0 respectively.)
How?
OIṠḟ0µL’aQ - Main link: s
O          - cast to ordinals
 I         - incremental differences
  Ṡ        - sign (-1 for decreasing, 0 for no change, 1 for increasing)
   ḟ0      - filter out zeros
     µ     - monadic chain separation
      L    - length
       ’   - decremented
        a  - and
         Q - unique items

Are you allowed to have 3 different possible outputs for the neither case?

I took "you decide how to represent it" to mean yes, so long as they are different. However your question about rule #5 could invalidate this (and probably every other entry).

Added an solution to that if need be.

Can you not just sum the list?

Oh, yes, of course >_< thanks.

R, 96 95 bytes
function(x,d=diff(rle(utf8ToInt(x))$v))if(any(d>0)&any(d<0)|sum(1|d)<2)3 else`if`(all(d<1),2,1)

Returns:

1 for wavy and raising
2 for wavy and decreasing
3 for non-wavy

Explained

d=diff(rle(utf8ToInt(x))$v): Generates a variable d by first converting the string into it's ASCII values using utf8ToInt which conveniently returns a vector. Subsequently perform run length encoding using rle. rle(...)$v returns the non-repeating values of the sequence (i.e. collapsing all runs). Finally take the difference.
if(any(d>0)&any(d<0)|sum(1|d)<2)3: If at least one of the differences are positive and at least one negative, or if the difference sequence has less than 2 elements (equivalent to the original word having less than 3 characters), the word is non-wavy and return 3
else``if``(all(d<1),2,1): Else if all differences are negative, return 2 for wavy and decreasing, else return 1 for wavy and raising.

Try all the test cases at R-fiddle (note that it's named such that it can be vectorized for the test cases).

Python 3, 77 75 bytes
lambda x:(len(set(x))>2)*(list(x)==sorted(x)or(list(x)==sorted(x)[::-1])*2)

Assumes all letters are of the same case.
Returns:

0 if not wavy
1 if forwards wavy
2 if backwards wavy

Removed unnecessary spaces thanks @ETHproductions

Welcome to PPCG, and nice first answer! However, you also need to make sure that there are at least three distinct chars in the string; if not, it's not a wavy word no matter what.

Ah, right. Should've looked closer at the definition of a wavy word. Fixed.

Nice! I'm not a Python expert, but I think you can remove the space on either side of the or.

Yep, you're right. Forgot to remove them after surrounding the expressions with parentheses. Thanks for the catch!

Python 2, 54 bytes
lambda s:[2<len(set(s))<s[::b]==sorted(s)for b in-1,1]

Takes input as a list of characters. Outputs:
[False, True] for ascending
[True, False] for descending
[False, False] for neither

Checks if the sorted input string equals its original or reverse. Does so by slicing with step sizes of 1 and -1. At the same time, we check whether the word has at least 2 distinct letters.
If "exit with error" can be used an output for the neither case, we can go down to 51 bytes:
lambda s:[s,s[::-(len(set(s))>2)]].index(sorted(s))

Pretty sure you can take a list of characters since it isn't specified as a string: http://meta.codegolf.stackexchange.com/a/2216/8478

JavaScript (ES6), 84 81 bytes
s=>(new Set(t=[...s]).size>2)*(!t.some((c,i)=>c>s[i+1])-!t.some((c,i)=>c<s[i+1]))

Assumes the input is all in the same case. Returns 1 for raising wavy, -1 for decreasing wavy, 0 or -0 (both are falsy) for not wavy. Edit: Saved 3 bytes thanks to @RobertHickman.

I'm not an expert on the newer features, but can you remove new?

@Cyoce Annoyingly the newer features require you to use new.

@Neil, I believe, You can save a byte by initializing another variable inside of the Set() function t=[...s] and using t instead of [...s] in those two spots you have it.

Javascript (ES6), 84 80 78 bytes
i=>new Set(s=[...i]).size>2?[i,s.reverse().join``].indexOf(s.sort().join``):-1

Where wavy increasing is 0, decreasing is 1, and -1 is not wavy.
Thanks to @Neil for helping me save 2 bytes.

new Set(s=[...i]) saves you 2 bytes. (It works by iterating i, turning it into an array, iterating the array, and turning that into a set. Convoluted but you don't worry about that sort of thing when you're golfing.)

PHP, 100 bytes
$n=$m=$l=str_split($argv[1]);sort($n);rsort($m);echo(($n==$l)-($m==$l))*(count(array_unique($l))>2);

Returns:

-1 for wavy, decreasing.
0 for not wavy.
1 for wavy, raising.

!!array_unique($s)[2] instead of count(array_unique($l))>2

Actually, the problem with that is that array_unique will preverse keys. Thus an input like aaabc will falsely output 0 when using array_unique.

Groovy - 56 bytes
{d=it[0];c=[0]*3;it.each{a->c[(a<=>d)]=1;d=a};c[1..-1]}
Outputs [1,0] for raising wavy, [0,1] for decreasing wavy, [0,0] for single character input or [1,1] for non-wavy.
NOTE: Assumes input is either a String or a char[] and all letters are of the same case.

Pyth, 12 bytes
x*<2lrQ8_BQS

Try it online. Test suite.

PHP, 96 Bytes
for(;($t=$argv[1])[++$i];)$s+=$r[]=$t[$i-1]<=>$t[$i];echo(max($r)-min($r)<2)*(0<=>$s)*(1<$s*$s);

or 98 Bytes
$s=str_split($t=$argv[1]);sort($s);echo(-($t==strrev($j=join($s)))|$t==$j)*!!count_chars($t,3)[2];

0 not wavy
1 raising
-1 decreasing

- instead of 2* (-1 for decreasing: -1 byte). *(!!...) needs no parentheses. (-2)

$s*$s>1 instead of abs($s)>1 (-2)

@Titus Done Thank You

Python 2, 53 52 50 bytes
Expects input enclosed in quotes, e.g. "watch"
As unnamed lambda:
lambda s:(sum(map(cmp,s[1:],s))+1)/min(len(s)-1,3)

Sums the sign of difference between each letters and integer-divides by len-1. If all were 1 (increasing) the sum is len-1 it displays 1, similar for decreasing -1 and for mixed 1,-1 the sum is smaller than len-1 so it displays 0.
-1 byte for changing cmp,s[1:],s[:-1]) to cmp,s[1:],s)+1

Will return 1 for "NO"

@JonathanAllan LMNOP so O is after N which means increasing which means 1

Yep, but any word of less than 3 characters (after removing any duplicate letters) was defined as not wavy ("NO" is in the not wavy test cases).

@JonathanAllan fixed the len issue, but i the repeating chars are still a problem

Ruby, 54 bytes
->w{c=w.chars.uniq;c==(s=c.sort)?2:(c==s.reverse)?1:0}

Returns 0 if the word is not wavy, 1 if backwards wavy, and 2 if forwards wavy.

C, 164 bytes
main(){char s[99];scanf("%s",s);char *c=&s;int p=*c;while(*c^0){if(p>*c){if(c-&s[0]>1)return 0;while(*c^0){if(p<*c)return 0;p=*c;c++;}return 2;}p=*c;c++;}return 1;}

Returns 0 if not wawy, 1 if wawy and raising, 2 if decreasing.

Racket 321 bytes
(let*((ld(λ(sl)(for/list((i(sub1(length sl))))(-(list-ref sl(add1 i))(list-ref sl i)))))(l(ld(remove-duplicates(map
(λ(x)(char->integer x))(string->list s)))))(am andmap)(N"Not WAVY")(d displayln))(cond[(<(length l)2)(d N)][(am(λ(x)(>= x 0))l)
(d"YES; RAISING")][(am(λ(x)(<= x 0))l)(d"YES; DECREASING")][else(d N)])))

Ungolfed:
(define (f s)
  (let*  ((ld (lambda(sl)          ; sub-fn to get differences in list elements
                (for/list ((i (sub1(length sl))))
                  (- (list-ref sl (add1 i))
                     (list-ref sl i) ) )))
          (l (ld
              (remove-duplicates
               (map
                (lambda(x)
                  (char->integer x))
                (string->list s)))))
          (am andmap)
          (N "Not WAVY")
          (d displayln))
    (cond
      [(< (length l) 2)(d N)]
      [(am (lambda(x) (>= x 0)) l) (d "YES; RAISING")]
      [(am (lambda(x) (<= x 0)) l) (d "YES; DECREASING")]
      [else (d N)]
      )))

Testing:
(f "ADEPT"); > YES > RAISING
(f "BEGIN"); > YES > RAISING
(f "BILL"); > YES > RAISING
(f "BOSS"); > YES > RAISING
(f "BOOST"); > YES > RAISING
(f "CHIMP"); > YES > RAISING
(f "KNOW"); > YES > RAISING
(f "SPONGE"); > YES > DECREASING
(f "SPOON"); > YES > DECREASING
(f "TROLL"); > YES > DECREASING
(f "WOLF"); > YES > DECREASING

(f "WATCH")
(f "EARTH")
(f "NINON")
(f "FOO")
(f "BAR")
(f "WAVE")
(f "SELECTION")

Output:
YES; RAISING
YES; RAISING
YES; RAISING
YES; RAISING
YES; RAISING
YES; RAISING
YES; RAISING
YES; DECREASING
YES; DECREASING
YES; DECREASING
YES; DECREASING
Not WAVY
Not WAVY
Not WAVY
Not WAVY
Not WAVY
Not WAVY
Not WAVY

Java 7, 254 240 bytes
import java.util.*;int c(String s){char[]a=s.toCharArray(),x=a.clone();Arrays.sort(x);return s.replaceAll("(.)\\1{1,}","$1").length()<3?0:Arrays.equals(a,x)|Arrays.equals(x,(new StringBuffer(s).reverse()+"").toCharArray())?a[0]>a[1]?1:2:0;}

Outputs 0 if the input string isn't wavy, 1 if it's a raising wave, and 2 if it's a decreasing wave.
Ungolfed & test code:
Try it here.
import java.util.*;
class M{
  static int c(String s){
    char[] a = s.toCharArray(),
           x = a.clone();
    Arrays.sort(x);
    return s.replaceAll("(.)\\1{1,}", "$1").length() < 3
            ? 0
            : Arrays.equals(a, x) | Arrays.equals(x, (new StringBuffer(s).reverse()+"").toCharArray())
               ? a[0] > a[1]
                  ? 1
                  : 2
               : 0;
  }

  public static void main(String[] a){
    System.out.print(c("ADEPT") + ", ");
    System.out.print(c("BEGIN") + ", ");
    System.out.print(c("BILL") + ", ");
    System.out.print(c("BOSS") + ", ");
    System.out.print(c("BOOST") + ", ");
    System.out.print(c("CHIMP") + ", ");
    System.out.println(c("KNOW"));

    System.out.print(c("SPONGE") + ", ");
    System.out.print(c("SPOON") + ", ");
    System.out.print(c("TROLL") + ", ");
    System.out.println(c("WOLF"));

    System.out.print(c("WATCH") + ", ");
    System.out.print(c("EARTH") + ", ");
    System.out.print(c("NINON") + ", ");
    System.out.print(c("FOO") + ", ");
    System.out.print(c("BAR") + ", ");
    System.out.print(c("WAVE") + ", ");
    System.out.print(c("SELECTION") + ", ");
    System.out.print(c("YES") + ", ");
    System.out.print(c("NO") + ", ");
    System.out.print(c("DEFINITION") + ", ");
    System.out.print(c("WATER") + ", ");
    System.out.print(c("WINE") + ", ");
    System.out.print(c("CODE") + ", ");
    System.out.print(c("AAAHHHH") + ", ");
    System.out.print(c("I") + ", ");
    System.out.print(c("MM") + ", ");
    System.out.println(c("ABCA"));
  }
}

Output:
2, 2, 2, 2, 2, 2, 2
1, 1, 1, 1
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

int c(char[]s){int t=s[0],f=s.length,a=1,b=1,i;for(i=1;i<f;){if(s[i]-s[i-1]>=0)++a;if(s[i]-s[i++-1]<1)++b;}return a==f?1:b==f?-1:0;}(132 bytes)

Output 1 if wavy raising,output -1 if wavy decreasing,0 if not wavy


text:
Chained Binary Operations
Chained Binary Operations
Here's a challenge involving truth tables and binary operations. For this specific challenge, your task is to use the following table of operations:

To create a function that takes in two inputs f(p,a), where p is the initial truthy/falsy value and a is a list of tuples representing multiple values of q and the operations to be performed. For instance, f(T,[[T,0],[T,1]]) would return ContradictionOP(T,T)=F. You would then chain the output of this result into the next operation, which would be LogicalNOR(F,T)=F, where the 2nd p is the previous output of F. The final result being false. A better breakdown of what each operation actually is is described below:

The first part should be rather simplistic in nature, as the operators are arranged in an increasing binary pattern (hint, hint). However, recursing through the additional inputs to chain binary operations is probably the harder part to accomplish.
Examples:
f(T,[])=T
f(F,[[F,15]])=T
f(T,[[F,15],[T,0],[F,6]])=F
f(T,[[F,15],[F,14],[F,13],[F,12],[F,11]])=F

Extrapolated Example:
f(T,[[F,15],[F,14],[F,13],[F,12],[F,11]])=F
[T,[F,15]]=T*
[T*,[F,14]=T*
[T*,[F,13]=T*
[T*,[F,12]=T*
[T*,[F,11]=F
FALSE.

Rules:

You MUST use the order specified for the operations as stated above.
The input format for a can be a 2D array, array of tuples, command line pairwise arguments or any other representation of pairs of boolean/operations. Could even be a single array that you parse pairwise.
You may use 0 for false and 1 for true, it is not acceptable to reverse the two.
The output should be simply a truthy or falsy value.
No loopholes, this is code-golf, standard CG rules apply.

Example Single Iteration Algorithm:
f={
    p,q,o->
    op=Integer.toBinaryString(o);     // Calculate the binary OP string (15=1111)
    binaryIndex="$p$q"                // Calculate binary combination of p/q (T/F=10)
    i=Integer.parseInt(binaryIndex,2) // Convert to decimal index (T/F=2)
    op.charAt(i)                      // Get the binary char at the calculated index (T/F/15=1).
}
f(1,0,15)                             // "1"

Can I accept e.g. f([T,[F,15],[T,0],[F,6]])?

@Neil, yeah, sure. That's fine. As long as p is distinct then you have pairs of operators. Can also be[true,[false,15],...]. Whatever a boolean is in your language. You do not have to use the character F or T. I was just using that to represent a boolean object.

This falls just short of my threshold for voting to close as unclear what you're asking, but only just. Is there any good reason for referring to the same operation as F in the first table, FalsyOp in the first example, and Contradiction in the second table? Using the same name consistently would make the question a whole lot more intelligible.

The ordinals are in the second image for each operation. A ContradictionOP (FalsyOP) returns false regardless of inputs. Look at the first table for all PQ, at ordinal 0 it should return false. Just like for ordinal 6 (XOR) it should return 0, 1, 1 or 0 depending on the PQ. Its actually quite simple if you read the provided code snippet and connect a few dots. Each operation's results can be accessed using the binary value of p+q and the binary operation code.

@PeterTaylor sorry... Its one of those things seeming complicated, but is quite simple due to a few factors.

CJam (15 bytes)
{{+)2@2b#/1&}/}

Online demo. This is an anonymous block (function) which takes the two values on the stack and leaves the result on the stack.
Dissection
{         e# Define a block:
  {       e#   For each pair in the array...
    +)2@  e#     Prepend the accumulator, pop the op, push a 2, and rot 3
          e#     Stack is now: op 2 [accum arg]
    2b#   e#     Find 2**(2*accum + arg)
    /1&   e#     Test the corresponding bit of op, setting it as the new accum
  }/
}

I like it! Nice job. I should add the rest of the OPs as test cases too.

JavaScript (ES6), 34 bytes
a=>a.reduce((l,[r,o])=>o>>l+l+r&1)

Accepts true/false but prefers 1/0 format.