自己发现的数学规律一

数学规律一

%是取余数运算

123 % 9 = 6

(1+2+3) % 9 = 6

3456795 % 9 = 3

(3+4+5+6+7+9+5) % 9 = 3

(-123) % 9= 3

[-(1+2+3)] % 9 = 3

将被除数记作A1A2A3...An,除数为9,余数记作q。

则有:

A1A2A3...An % 9 = q1

(A1+A2+A3+...+An) % 9 = q2

(-A1A2A3...An) % 9 = q3

[-(A1+A2+A3+...+An)] % 9 = q4

规律1:q1 = q2; q3 = q4

任意一个整型数除以9得到的余数,等于,该整型数的每一位上的数值之和除以9得到的余数。只有当除数是9的情况下此规律才成立,当除数是8、7等其他数值时,此规律不成立。如果该整型数为负数,则先求各位上的数值之和,然后将该和乘以(-1)即变为负数,该整型数除以9得到的余数,仍然等于,该整型数各位数之和(乘以(-1)后得到的负数)除以9得到的余数。

时间: 2024-08-01 22:37:40

自己发现的数学规律一的相关文章

自己发现的数学规律二

mod()是取余数函数 mod(15, 7) = 1 mod(15, -7) = -6 mod(-15, 7) = 6 mod(-15, -7) = -1 15 = 7 * 2 + 1 15 = (-7) * (-3) + (-6) -15 = 7 *(-3) + 6 -15 = (-7)*2 + (-1) 将被除数.除数.商.余数分别记作m.n.p.q (m, n, p, n >= 0) 则有: m = n * p1 + q1 m = (-n) * (-p2) + (-q2) -m = n *

HDU 1005 Number Sequence (数学规律)

Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 104190    Accepted Submission(s): 25232 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A

hihoCoder 1584 Bounce 【数学规律】 (ACM-ICPC国际大学生程序设计竞赛北京赛区(2017)网络赛)

#1584 : Bounce 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 For Argo, it is very interesting watching a circle bouncing in a rectangle. As shown in the figure below, the rectangle is divided into N×M grids, and the circle fits exactly one grid. The bouncing

[C++]LeetCode: 114 Permutation Sequence(返回第k个阶乘序列——寻找数学规律)

题目: The set [1,2,3,-,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3): "123" "132" "213" "231" "312" &q

Uva 1315 - Creaz tea party ( 数学 + 规律 )

Uva 1315 - Creaz tea party (  数学 + 规律 ) 题意: 一个环,围在一个坐了N个人.每次操纵可以交换相邻的两个人的位置.求最少需要交换几次,可以变为逆序. 这里的逆序指的是原来在A左边的人在A的右边,在A右边的在A的左边. 分析: 如果是线性的,,,果断类似冒牌排序(n)(n-1)/2 但是这里是环,推了推但是推不出结果..结论是将环分为两段线性的序列,线性的满足上面的公式. 如:     1 2 3 4 5  线性:  5 4 3 2 1  ( 10次 ) 环状

【算法学习笔记】73.数学规律题 SJTU OJ 1058 小M的机器人

Description 小M有很多个机器人,他们要么一直说真话,要么一直说假话. 然后每个人都说: (1). 不到N个人比我工作得多 (2). 至少M个人的工资比我高. 保证没有两个人的工作一样重,也没有两个人的工资一样高,问至少有多少机器人? Input Format 一行两个数整数N, M (  1≤N,M < 2^31) Output Format 一个整数K表示至少有K个人 Hint 想不出来的同学... 不要想得太复杂了... Sample Input 2 2 Sample Outpu

UVA10940 Throwing cards away II【数学规律+约瑟夫环】

Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck: Throw away the top card and move the card that is now on th

PAT甲级——1104 Sum of Number Segments (数学规律、自动转型)

本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90486252 1104 Sum of Number Segments (20 分) Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3,

Codeforces Round #272 (Div. 2) D. Dreamoon and Sets (思维 数学 规律)

题目链接 题意: 1-m中,四个数凑成一组,满足任意2个数的gcd=k,求一个最小的m使得凑成n组解.并输出 分析: 直接粘一下两个很有意思的分析.. 分析1: 那我们就弄成每组数字都互质,然后全体乘以k不就行了么…… 然后看了看样例…… 这个该怎么说……我是觉得额这道题的output暴露了数据规律怎么破……我算是看出规律再证明的方式A的这道题 当时我看到22那个样例的时候……在想他干嘛要把22放这里……然后发现 2/4/6/10 14/16/18/22也是行的哇…… 化成乘以k之前的数据……