-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEuler_Problem-025.b93
74 lines (52 loc) · 3.77 KB
/
Euler_Problem-025.b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
v
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000001 00000000000000000000000000000000000000000000000001
>5567***00p"2"10p 230p>v
> > 00g40p050p>40g1-40p40g10g%"4"+40g10g/1+g"0"-:40g10g%1+40g10g/1+g"0"-50g++ v
v< v< |g04p+1/g01g04+1%g01g04+"0"p+1/g01g04+"4"%g01g04+"0"%+55p05/+55:<
^<|-*+55"d"-g07g00<|-"0"g+1/g01g07+"4"%g01g07<p070p03+1g03<
>30g.@ >70g1+70p ^
[0,0] DigitCount (1050)
[1,0] GridWidth (50)
[3,0] Current FibonacciIndex
[4,0] (Add) Current Index
[5,0] (Add) Carry
[7,0] (Count) Current Index
5567*** => 1050
"2" => 50
// LeftSide
40g10g%1+40g10g/1+ [gp] ["0"-]
// RightSide
40g10g%"4"+40g10g/1+ [gp] ["0"-]
// Add and move
v
RIGHT SIDE LEFT SIDE CARRY PUT RIGHT PUT LEFT
> 00g40p050p>40g1-40p 40g10g%"4"+40g10g/1+g"0"-: 40g10g%1+40g10g/1+g"0"- 50g ++ :55+/50p55+% "0"+40g10g%"4"+40g10g/1+p "0"+40g10g%1+40g10g/1+p v
|g04 <
@
// Get (RightSide) DigitCount (result on stack)
>v
070p> 70g10g%"4"+70g10g/1+g"0"-|> 00g70g-
^p07+1g07 <
---------------------------------------
And for like the 5th time i implement an long addition algorithm. On the right side is the current number and on the left side the last number.
The only interesting thing here is probably that I calculate the next number and move the current to the left in a single cycle.