Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VIGS-22-demo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Grellscheid
VIGS-22-demo
Commits
74956409
Commit
74956409
authored
2 years ago
by
David Grellscheid
Browse files
Options
Downloads
Patches
Plain Diff
Starting scaffold for euler problem 14
parents
Branches
main
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
euler014.py
+14
-0
14 additions, 0 deletions
euler014.py
test_euler014.py
+12
-0
12 additions, 0 deletions
test_euler014.py
with
26 additions
and
0 deletions
euler014.py
0 → 100644
+
14
−
0
View file @
74956409
import
sys
def
collatz_len
(
N
):
return
1
,
1
if
__name__
==
"
__main__
"
:
# should really use argparse here
if
len
(
sys
.
argv
)
<
2
:
print
(
f
"
Usage:
{
__file__
}
NNN
"
)
exit
(
1
)
max_N
=
int
(
sys
.
argv
[
1
])
start
,
length
=
collatz_len
(
max_N
)
print
(
f
"
The longest collatz chain up to
{
N
}
starts at
{
start
}
and has
{
length
}
elements.
"
)
This diff is collapsed.
Click to expand it.
test_euler014.py
0 → 100644
+
12
−
0
View file @
74956409
import
euler014
as
E
def
test_collatz_len_returns_tuple
():
assert
len
(
E
.
collatz_len
(
1
))
==
2
def
test_collatz_step_odd
():
assert
E
.
collatz_step
(
3
)
==
7
def
test_collatz_step_even
():
assert
E
.
collatz_step
(
10
)
==
5
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment