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
-1
votes
4 answers

why does this php code return me 13 and not 3? I'm really confused

Can someone tell me why the output of echo of this Code is 13? $a=10; $b=2; $j=$a/2; for ($i=0;$i<$j;$i++){ if ($i % $b == 1) echo "$i"; }
-1
votes
1 answer

How to Solve Similar No Of Parameter Combinations in Urls using Mod Rewrite Rule in Htaccess PHP

I have Four Urls which need to be optimized using ht-access PHP. All Parameter values stored in DB. First url : has TWO Parameters and values in the un-optimized url. 1st - (scode)Parameter used for Alphabets - Ex: Only state codes: DL or AP 2nd -…
prabhakar
  • 1
  • 3
-1
votes
3 answers

Image.fromarray() is making every element in the matrix mod of 256

I am writing a script to encrypt and decrypt an image in python3 using PIL. Here I am converting the image into a numpy array and then multiplying every element of the array with 10. Now I noticed that the default function in PIL fromarray() is…
Sandipan
  • 683
  • 8
  • 25
-1
votes
1 answer

mod and case not working together for delphi

I'm trying to make a calculator at delphi but I have a problem in the mod area, I haven't found how to solve it. procedure TfrmHesapMakinesi.Button1Click(Sender: TObject); var sayi1:double; sayi2:double; sonuc:double; islem:byte; begin …
Macex
  • 3
  • 3
-1
votes
3 answers

is there an alternative to using mod "%" in python

I am trying to cycle through a list of numbers (mostly decimals), but I want to return both 0.0 and the max number. for example maxNum = 3.0 steps = 5 increment = 0 time = 10 while increment < time: print increment * (maxNum / steps)% maxNum …
user1869582
  • 449
  • 1
  • 3
  • 10
-1
votes
1 answer

The mod function isn't working properly for me

When I input 36011 it results in the second(s) output being 36011 instead of 11, I made sure the compiler settings were set correctly and everything. I genuinely don't know what else to do, I have to use long long int for this assignment and it's…
Ethan
  • 1
-1
votes
1 answer

Visual Basic Random Number/Mod

I am currently working on some homework for my Visual Basics class I have to generate two random numbers, then either add them, subtract them, divide them, or multiply them. (the user would try to guess the answer) The only problem I am going to run…
brendan4t
  • 1
  • 1
-1
votes
4 answers

mod function not working why?

#include using namespace std; int c; int fun_div(); int fun_div(int a,int b){ if(a%b==0){ c=1; cout<<"Solution Available :\t"<
-1
votes
1 answer

Excel - Summary calculation

Could someone please help me to figure out How to get the summary for every month from the grid in Excel? Please find the following image for the information. Thank you in advance.
Suriya J
  • 1
  • 5
-1
votes
4 answers

Find Divisible Sum Pairs in an array in O(n) time

You are given an array of n integers a0, a1, .. an , and a positive integer k. Find and print the number of pairs (i,j) where and i+j is evenly divisible by k (Which is i+j % k == 0). This problem has been taken from here. We need a solution in…
FlyingAura
  • 1,541
  • 5
  • 26
  • 41
-1
votes
1 answer

Unable to understand the result of this hash function

I was reading my notes from the algorithms class (several years old) and I found this: which says: Assuming that h(k) = k mod m, where m = 4 and k = 100, then h(k) = 4 Is this true? I would think that 4 * 25 = 100, thus h(k) = 0. What am I…
gsamaras
  • 71,951
  • 46
  • 188
  • 305
-1
votes
1 answer

Calculating big numbers with mod and pow

i was trying to solve the big mod problem using the following code. #include #include using namespace std; typedef long int li; li m; li mod(li b,li p) { if(p==0) return 1; if(p%2==0) { return…
Reshad
  • 220
  • 5
  • 19
-2
votes
1 answer

Error Exception in thread "main" java.lang.ExceptionInInitializerError while doing a Minecraft mod

so, I am following a Minecraft modding tutorial in 1.16, I use Eclipse and 1.16.4 mdk, everything was going great until I try to launch the game, it keeps getting an error, here is the console : 2023-04-25 18:39:51,378 main WARN Advanced terminal…
Fenl
  • 3
  • 1
-2
votes
1 answer

C# mod gives wrong answer not as python mod (%)

I'm trying to get % result of ( -1%26 ) the result should be 25 in python it's right but C# gives -1 as result why and how to get 25 in C# not -1
AwadhJY
  • 1
  • 2
-2
votes
1 answer

Can someone please explain this Excel function? =OFFSET($A$1,MOD(ROW()-ROW($CL$1),ROWS($A$1:$A$281)),TRUNC((ROW()-ROW($CL$1))/ROWS($A$1:$A$281)),1,1)

After a Google search, I learned that the following function (or rather, blending of functions) stacks existing columns: =OFFSET($A$1,MOD(ROW()-ROW($CL$1),ROWS($A$1:$A$281)),TRUNC((ROW()-ROW($CL$1))/ROWS($A$1:$A$281)),1,1) I'd like to know what each…