有趣的数-回文数(Palindrome number)
文章转自http://blog.163.com/hljmdjlln@126/blog/static/5473620620120412525181/
做LC上的题"Palindrome number"时翻到此文章,经过少量修改后如下。
回文数是数学界中的一种有趣的现象。比如121就是一个回文数。回文数的数字互相对应,从中间一个任意一位数字起,左右每隔一个的数字都相等。回文数有许多神奇的规律和奥秘。主要分为读数回文数、平方回文数、乘积回文数以及倒乘回文数。
一、读数回文数
【解释】读数回文数是指一个正整数,正着读和倒着读内容一致。
【举例】数字:98789
正读:九万八千七百八十九(98789)
倒读:九万八千七百八十九(98789)
正读与倒读内容一致,所以这个数字就是读书回文数。
注:读书回文数的数位都是奇数个。
二、 平方回文数
【释】平方回文数是指,一个数的平方是一个回文数。
【举例】11^2=121,111^2=12321,1111^2=1234321 ,122^2=484
三、回文算式
【解释】等号左边是两个或多个因数相乘,右边是它们的乘积或几个因数相乘。如果把每个算式中的“×”和“=”去掉,那么,它们都变成回文数,所以,我们不妨把这些算式叫做“回文算式”。
【举例】3×51=153
6×21=126
4307×62=267034
9×7×533=33579
12×42=24×21
34×86=68×43
102×402=204×201
1012×4202=2024×2101
不知你是否注意到,如果分别把上面的回文算式等号两边的因数交换位置,得到的仍是一个回文算式。比如:
42×12=21×24 ,
43×68=86×34,
仍是回文算式。
还有更奇妙的回文算式,请看:
12×231=132×21(积是2772),
12×4032=2304×21(积是48384),
这种回文算式,连乘积都是回文数。
注:四位的回文数一定能被11整除。设它为abba,那它等于a*1000+b*100+b*10+a=1001a+110b,能被11整除。
另外,在数学上还有一种算式称为『回文式』。回文式即是从左右看皆通的算式。
你们且看 112 x 113 = 12656 这条算式的特别之处?只要把此算式由尾写起,即成为以下式子
65621 = 311 x 211,可以发现两条算式均成立。
112不但乘以113有此特性,乘以某些数也有同样的效果:
(1) 112 x 124 = 13888 将式子由右到左写是 88831 = 421 x 211
(2) 112 x 133 = 14896 将式子由右到左写是 69841 = 331 x 211
(3) 112 x 223 = 24976 将式子由右到左写是 67942 = 322 x 211
其实,某些平方数也有此结果:
12 x 12=144将式子由右到左写是 441= 21 x 21
13 x 13=169将式子由右到左写是 961=31 x 31
经过仔细发现,我们在完全平方数,完全立方数中也找到了不少『回文』的例子,它令我们理性的数学平添了不少感性的诗情画意。
有趣的数-回文数(Palindrome number)的更多相关文章
- leecode刷题(31) -- 回文数
leecode刷题(31) -- 回文数 回文数 判断一个整数是否是回文数.回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数. 示例 1: 输入: 121 输出: true 示例 2: 输 ...
- 有趣的回文数(Palindrome number)
文章转自http://blog.163.com/hljmdjlln@126/blog/static/5473620620120412525181/ 做LC上的题"Palindrome num ...
- leetcode 9 Palindrome Number 回文数
Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...
- LeetCode Problem 9:Palindrome Number回文数
描述:Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could nega ...
- Leetcode 3——Palindrome Number(回文数)
Problem: Determine whether an integer is a palindrome. Do this without extra space. 简单的回文数,大一肯定有要求写过 ...
- palindrome number(回文数)
Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negativ ...
- [Swift]LeetCode9. 回文数 | Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...
- [Leetcode] Palindrome number 判断回文数
Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...
- [LeetCode]9. Palindrome Number回文数
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...
随机推荐
- spring+springmvc+mybatis整合
1.web.xml配置 <?xml version="1.0" encoding="UTF-8"?> <web-app version=&qu ...
- [Jquery]网页定位导航特效
描述:左右联动的导航,非常适合展示页面内容多,区块划分又很明显的,点击右边固定导航项时,左边的内容跟着切换.滑动滚动条的时候,右边的导航也随着左边的展示而进行高亮切换. 思路:比较滚动距离和楼层距离( ...
- DotNetBar v12.7.0.10 Fully Cracked
更新信息: http://www.devcomponents.com/customeronly/releasenotes.asp?p=dnbwf&v=12.7.0.10 如果遇到破解问题可以与 ...
- @ResultMapping注解
@RequestMapping注解1.url映射放在方法上:@RequestMapping("/itemsEdit")2.窄化url请求映射放在类上,定义根路径,url就变成根路径 ...
- Linear Predictors
In this chapter we will study the family of linear predictors, one of the most useful families of hy ...
- android studio只能全部提示设置
- IIS 发布后文件拒绝访问
今天遇到一个很小的问题,代码中写XML文件,本地运行没有问题,一发布到服务器上就出现 代码如下: XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load ...
- hdu1078 bfs
//Accepted 468 KB 812 ms //bfs+dp #include <cstdio> #include <cstring> #include <iost ...
- Python 字符串处理大全.
Python 字符串 字符串是Pyhton中常用的数据类型,我们可以使用引号来创建字符串 . 创建字符串很简单 , 就不说了 . Python 访问字符串中的值 鬼叔本着简洁 使用的设计目的 , 在设 ...
- 【Zhejiang University PATest】02-1. Reversing Linked List
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elem ...