Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RSA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nicolas.albanesi
RSA
Commits
c64cc5d4
Commit
c64cc5d4
authored
3 years ago
by
nicolas.albanesi
Browse files
Options
Downloads
Plain Diff
Merge branch '3-create-function-exp_rapide' into 'main'
Resolve "Create function exp_rapide" Closes
#3
See merge request
!3
parents
b0eec710
25bfef1e
No related branches found
No related tags found
1 merge request
!3
Resolve "Create function exp_rapide"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/exp_rapide.py
+28
-0
28 additions, 0 deletions
src/exp_rapide.py
with
28 additions
and
0 deletions
src/exp_rapide.py
0 → 100644
+
28
−
0
View file @
c64cc5d4
def
exp_rapide
(
nb
:
int
,
exp
:
int
,
mod
:
int
)
->
int
:
list_exp
=
[
int
(
x
)
for
x
in
bin
(
exp
)[:
1
:
-
1
]]
# Créer la liste de l'exp decomposé
a
=
[]
a
.
append
(
nb
**
1
%
mod
)
for
x
in
range
(
1
,
len
(
list_exp
)):
a
.
append
(
a
[
x
-
1
]
**
2
%
mod
)
# Calcule l'exp rapide
out
=
1
for
index
,
valeur
in
enumerate
(
list_exp
):
if
valeur
==
1
:
out
*=
a
[
index
]
%
mod
return
out
%
mod
if
__name__
==
'
__main__
'
:
u
=
68393426
n
=
124344401
d
=
29995379
# print(exp_rapide(6, 392, 13))
print
(
exp_rapide
(
u
,
d
,
n
))
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