Questions tagged [mod]

For questions related with the *mod operation*, that can arise in Cryptography, Number Theory, Hashing, etc..

In computing, the modulo operation finds the remainder after division of one number by another (sometimes called modulus). Given two positive numbers, a (the dividend) and n (the divisor), a modulo n (abbreviated as a mod n) is the remainder of the Euclidean division of a by n.

437 questions
0
votes
1 answer

What is the time complexity of below code(recursive function) with respect to 'a'

Time complexity of the recursive call How 'a' value is decremented throughout the recursive call. Is it o(log a) or O(log log a) or something else int result(int a, int b) { if( a %b == 0) return b; a = a % b; return result(b,a); }
0
votes
1 answer

modular exponentation funcation generate incorrect result for big input in c

I try two function for modular exponentiation for big base return wrong results, One of the function is: uint64_t modular_exponentiation(uint64_t x, uint64_t y, uint64_t p) { uint64_t res = 1; // Initialize result x = x % p; //…
superstack
  • 91
  • 5
0
votes
0 answers

avoiding mod() by exploiting overflow or using if statements

For my project I need to cycle through an array of values. The number of elements and values are chosen at compile time. Currently I use mod to cycle through these values in various different ways (i.e not necessarily a simple i++). However, I look…
user1512321
0
votes
1 answer

Leetcode 686 Repeated String Match Having Trouble Understanding the Explanation

I am having trouble understanding why the solution of Leetcode's Repeated String match only goes up to q + 1 repeats of A (if A.length() < B.length()) for B to be a possible substring of A repeated. I read other StackOverflow solutions as well as…
ambition
  • 1
  • 2
0
votes
1 answer

I can t change values of addresses which doesnt have offset

The first one doesnt work but the second one working good but why? WriteInt32((IntPtr)0x4EE444, 0); WriteInt32((IntPtr)0x510CE0, 0); it doesn t give any error message it just doesn t change it
Eren Özkan
  • 59
  • 1
  • 4
0
votes
1 answer

Redirect rule not being followed

I have set up the following conf files for my apache site and enabled mod rewrite, but I'm having issues getting the rule to fire. I'm fairly confident it's a missed configuration, but I'm not sure where it lies. I have been experimenting with…
Morcalavin
  • 142
  • 2
  • 9
0
votes
3 answers

Find First and Last Number in a Range of Numbers

Imagine a range of numbers from -133 to +71. I want to find the first and last numbers in the range that divide by 20: in this case it would be -120 and +60. I can write a For loop that tests each value and stores the required values: Dim…
Tim Makins
  • 394
  • 4
  • 12
0
votes
0 answers

Don't starve Lua: Can't figure out how to spawn additional bamboo with each bamboo tree, or other machete resources

I'm building, or trying to build, a mod called More Drops (DS). I ported it to Don't Starve from "Don't Starve Together", so my lua knowledge is very limited, but I've been working on this thing for days and can't figure it out, so I need to ask for…
Amnesiac
  • 3
  • 3
0
votes
1 answer

Cannot retrieve Original image from Encrypted image In Python using PIL

I am writing a script that can encrypt and decrypt an image using the RSA algorithm. My public key is (7, 187) and the private key is (23,187) now the calculation for the encryption is correct like for an entry in the matrix of the image, 41 the…
Dutta
  • 326
  • 1
  • 3
  • 10
0
votes
1 answer

ejabberd mod_push and mod_push_keepalive does not start

I run a ejabberd 16.09 server on Debian Stretch. When I enable the modules mod_push and/or mod_push_keepalive the server doesn´t start and the log file tells: 2019-03-15 11:16:03.535 [critical] <0.61.0>@gen_mod:start_module:162 Problem starting the…
0
votes
1 answer

A misunderstanding about MOD statements or FOR loops in Pascal

I'm trying to teach myself Pascal, and am putting together a program to determine prime numbers. It's crude, and inaccurate, but just a practice exercise. I've created a FOR loop that will see if a counted number has a remainder if divided by a…
TThoms
  • 1
  • 1
0
votes
2 answers

Convert a shifted ASCII value to char inside the abc scope

Background This question is inspired by The Caesar Cipher. Given a modified ASCII value i where i > 122 or i < 97, the goal is to find the char represented by its value. For example, since 'z' value is 122, then 123 references 'a', as well as 149…
Ori David
  • 332
  • 3
  • 13
0
votes
1 answer

.htaccess question - the [L] flag any way to simplify

I usually use MVC routing but I have to work on a site with non MVC and need to add a new feature. Here is my commnads which works: RewriteRule ^blog/why-am-using-htaccess/$ viewBlog.php?blogHook=$1 [L] RewriteRule ^blog/(.*) blogs.php…
0
votes
1 answer

Access calculated number Field: modulo problem

I have a problem with my expression in a Calculated field in an access [2007] table. I need to find out if a number is odd or even but I can't get the Modulo function to work. This doesn't work: IIf( [No] Mod 2 = 0, [No] - 1, [No] + 1) [ Just to…
Stealth
  • 25
  • 4
0
votes
0 answers

Calculating Modulo between 2 large numbers represented as strings

I am trying to compute % of large numbers. I managed so far with the dividend to be large and the mod represented as integer. I have no idea how to do otherwise. I need this exactly for Large numbers division that is why I need this. No, I will not…
Prekzursil
  • 11
  • 2