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
1 answer

Numbers that are divisible by 2 and 3 are not printing in PL/SQL

First 20 numbers that are divisible by both 2 and 3 are not printing. Instead, bunch of 0's show up. I am trying to print first 20 numbers that are divisible by both 2 and 3. Below is my code: SET SERVEROUTPUT ON; DECLARE n number := 0; …
Luke
  • 3
  • 2
-1
votes
1 answer

Filling in a vector with random numbers

I'm trying to print random numbers using srand. This is my code. I want each subsequent number larger than the previous number in the list. This is my code. #include #include #include #include #include…
Justin
  • 177
  • 8
-1
votes
1 answer

who can i get all objectReference from current skyrim room using papyru script

i'm traying to get all objectReferences of all objecst in the current skyrim room.. i want to recreate the scene of harry potter when Dumbledore reorganize the mess of Horace Slughorn. you can see the scene in this link…
Jorge V
  • 1
  • 1
-1
votes
1 answer

Why is there no overflow check in the Jenkins one-at-a-time hash function?

uint32_t jenkins_one_at_a_time_hash(const uint8_t* key, size_t length) { size_t i = 0; uint32_t hash = 0; while (i != length) { hash += key[i++]; hash += hash << 10; hash ^= hash >> 6; } hash += hash << 3; hash ^= hash >>…
user10990333
-1
votes
1 answer

How can I fix my code to work for all of the tests?

Decide whether the items in the list all give the same remainder divided by two. My code is working when the mod is 1, but it is not working when the mod is 0. What do I have to add to work? An if - else statement or something else? sameParity ::…
mano19
  • 55
  • 6
-1
votes
1 answer

Splitting list into odd and even (Haskell)

I need to create a function that will take a list of integers and split them into 2 lists, one with odd numbered and the other even split :: [a] -> ([a], [a]) split = undefined Above is the function baseline, below is current attempt I have split…
-1
votes
1 answer

PHP for loop do something different to every second and third item

I am using a for loop to create a grid of items in a three by X pattern. Each column of items needs to have different properties but I am struggling to fin a solution to accurately select the correct items. Currently I have been trying to use Mod…
Edward144
  • 493
  • 6
  • 28
-1
votes
1 answer

Modding Android Apps

So I Was Modding A Game Earlier Which Used C# Dlls But Now With Updated Unity Engine They Have LibIL2CPP So I Converted libil2cpp To Normal C# Dll's Which Had Offsets For libil2cpp.so I Modded The Game I Could Not Find Some Function Such As Keys…
Gurdev212
  • 1
  • 1
-1
votes
1 answer

Java efficient way to extract from encoded number

I have an encoded Java integer: 1ABCDEFGH ex1: 123561287 ex2: 184236230 I wish to extract 2-digit pairs after first digit. In this case, it would be: ex1: 23, 56, 12, 87 ex2: 84, 23, 62, 30 The naive way I came up was to repeatedly divide by 100…
akram
  • 157
  • 1
  • 15
-1
votes
1 answer

Calculating a^b mod p for a large prime p

I'm trying to write a python code that calculates a^b mod p, where p = 10^9+7 for a list of pairs (a,b). The challenge is that the code has to finish the calculation and output the result in < 1 second. I've implemented successive squaring to…
Ibrahim M
  • 3
  • 1
-1
votes
1 answer

Fortran DMOD vs Python numpy.remainder

Why do I get different results using "DMOD" in Fortran and "numpy.remainder" in Python? In Fortran: DOUBLE PRECISION aaa,bbb aaa = 2.11561 bbb = 1.19841 out = DMOD(aaa, bbb) print*,out and I get: 0.917199850 In python: import numpy as…
scana
  • 111
  • 1
  • 11
-1
votes
2 answers

Function returns None when it should return the last index

I'm trying to get this function to return the index of the smallest value in a list. It works for every case besides if the smallest value is the last element of the list. Can anyone spot my mistake? def rotation_point(rotated_list): length =…
-1
votes
1 answer

Update Laravel Migration command to have all common imports and fields in one go for migration file

I have Enums which I am using it in almost all files for migration. Important them one by one is lots of work every time. Is there a way I can modify the template for laravel migration command and add those imports at the start itself and also if…
princeoo7
  • 1,071
  • 3
  • 21
  • 44
-1
votes
2 answers

C++ String individual characters

I'm trying to make a function that takes the first and last letters of a string, divides them for the modulus and stores them in an array spot related to the modulus number. However I don't know how I would get the first and last letters of the…
-1
votes
2 answers

How do I use modular arithmetic on a list, I wish to mod 121 after each enumerated number?

I have a list that's is enumerated and I wish to use modular arithmetic on each number, but not the enumerated numbers. How do I do this? This question regards only list modular arithmetic not a simple operation. How do I mod 121 each of these…
Tom E. O'Neil
  • 527
  • 4
  • 10