文章转自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)的更多相关文章

  1. leecode刷题(31) -- 回文数

    leecode刷题(31) -- 回文数 回文数 判断一个整数是否是回文数.回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数. 示例 1: 输入: 121 输出: true 示例 2: 输 ...

  2. 有趣的回文数(Palindrome number)

    文章转自http://blog.163.com/hljmdjlln@126/blog/static/5473620620120412525181/ 做LC上的题"Palindrome num ...

  3. leetcode 9 Palindrome Number 回文数

    Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...

  4. LeetCode Problem 9:Palindrome Number回文数

    描述:Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could nega ...

  5. Leetcode 3——Palindrome Number(回文数)

    Problem: Determine whether an integer is a palindrome. Do this without extra space. 简单的回文数,大一肯定有要求写过 ...

  6. palindrome number(回文数)

    Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negativ ...

  7. [Swift]LeetCode9. 回文数 | Palindrome Number

    Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...

  8. [Leetcode] Palindrome number 判断回文数

    Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...

  9. [LeetCode]9. Palindrome Number回文数

    Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...

随机推荐

  1. JVM优化之调整大内存分页(LargePage)

    转自:http://cjjwzs.iteye.com/blog/1059381 本文将从内存分页的原理,如何调整分页大小两节内容,向你阐述LargePage对JVM的性能有何提升作用,并在文末点明了大 ...

  2. JDE变量说明

    BC Business view columns. Columns that are included in the attached business view. These columns are ...

  3. spring mvc如何获取问号后的url参数

    @RequestMapping(method=RequestMethod.GET) public ModelAndView allUsers(@RequestParam int page){ Mode ...

  4. ViewPager滑动页面的实现方法

    package com.lixu.pagerview; import java.util.ArrayList; import android.app.Activity; import android. ...

  5. ng-repeat的group

     http://blog.csdn.net/violet_day/article/details/17023219 一.obj包含 <!doctype html> <html ng- ...

  6. 初步比较zeromq vs. wcf

    用最简单的Calculator比较zeromq的req-rep模式 vs. wcf的http和net.tcp模式,看哪一种的传输性能更高. 1.比较结果如下 方式 耗费时间 wcf_http_sing ...

  7. TClientDataSet 设计期 多次New 字段问题

    第一次New几个字段后,右键菜单CreateDataSet 后来需要再New几个字段. 右键菜单,先 ClearData(不这样,会报 打开的数据集不能执行 这个New字段的操作),然后在 字段编辑器 ...

  8. struts中的数据校验

    1.struts中如何进行数据校验 在每一个Action类中,数据校验一般都写在业务方法中,比如login().register()等.struts提供了数据校验功能.每个继承自ActionSuppo ...

  9. UITextView添加一个placeholder功能

    控件UITextField有个placeholder属性,UITextField和UITextView使用方法基本类似,有两个小区别:1.UITextField单行输入,而UITextView可以多行 ...

  10. Flux Demo解析

    最近学习了阮一峰老师的博文 "Flux入门教程",博文中详细介绍了Flux框架和Controller view模式,并提供了Demo,受益匪浅. 现特参考阮老师的Demo,绘制了一 ...