`
l1t
  • 浏览: 834 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

一个猜手机号码的游戏用SQL解答

阅读更多
用SQL语句猜猜手机号码?


11位数字,其中0123456789都在里面,可以分解成两个不小于10000的素数相乘?
数量太多,暂时限制130打头的

set timi on lines 132 pages 50000
col n format 99999999999
with sp as(
select 3 s from dual union all
select 5 from dual union all
select 7 from dual union all
select 11 from dual union all
select 13 from dual union all
select 17 from dual union all
select 19 from dual union all
select 23 from dual union all
select 29 from dual union all
select 31 from dual union all
select 37 from dual union all
select 41 from dual union all
select 43 from dual union all
select 47 from dual union all
select 53 from dual union all
select 59 from dual union all
select 61 from dual union all
select 67 from dual union all
select 71 from dual union all
select 73 from dual union all
select 79 from dual union all
select 83 from dual union all
select 89 from dual union all
select 97 from dual union all
select 101 from dual union all
select 103 from dual union all
select 107 from dual union all
select 109 from dual union all
select 113 from dual union all
select 127 from dual union all
select 131 from dual union all
select 137 from dual union all
select 139 from dual union all
select 149 from dual union all
select 151 from dual union all
select 157 from dual union all
select 163 from dual union all
select 167 from dual union all
select 173 from dual union all
select 179 from dual union all
select 181 from dual union all
select 191 from dual union all
select 193 from dual union all
select 197 from dual union all
select 199 from dual union all
select 211 from dual union all
select 223 from dual union all
select 227 from dual union all
select 229 from dual union all
select 233 from dual union all
select 239 from dual union all
select 241 from dual union all
select 251 from dual union all
select 257 from dual union all
select 263 from dual union all
select 269 from dual union all
select 271 from dual union all
select 277 from dual union all
select 281 from dual union all
select 283 from dual union all
select 293 from dual union all
select 307 from dual union all
select 311 from dual union all
select 313 from dual union all
select 317 from dual union all
select 331 from dual union all
select 337 from dual union all
select 347 from dual union all
select 349 from dual union all
select 353 from dual union all
select 359 from dual union all
select 367 from dual union all
select 373 from dual union all
select 379 from dual union all
select 383 from dual union all
select 389 from dual union all
select 397 from dual union all
select 401 from dual union all
select 409 from dual union all
select 419 from dual union all
select 421 from dual union all
select 431 from dual union all
select 433 from dual union all
select 439 from dual union all
select 443 from dual union all
select 449 from dual union all
select 457 from dual union all
select 461 from dual union all
select 463 from dual union all
select 467 from dual union all
select 479 from dual union all
select 487 from dual union all
select 491 from dual union all
select 499 from dual union all
select 503 from dual union all
select 509 from dual union all
select 521 from dual union all
select 523 from dual union all
select 541 from dual union all
select 547 from dual union all
select 557 from dual union all
select 563 from dual union all
select 569 from dual union all
select 571 from dual union all
select 577 from dual union all
select 587 from dual union all
select 593 from dual union all
select 599 from dual union all
select 601 from dual union all
select 607 from dual union all
select 613 from dual union all
select 617 from dual union all
select 619 from dual union all
select 631 from dual union all
select 641 from dual union all
select 643 from dual union all
select 647 from dual union all
select 653 from dual union all
select 659 from dual union all
select 661 from dual union all
select 673 from dual union all
select 677 from dual union all
select 683 from dual union all
select 691 from dual union all
select 701 from dual union all
select 709 from dual union all
select 719 from dual union all
select 727 from dual union all
select 733 from dual union all
select 739 from dual union all
select 743 from dual union all
select 751 from dual union all
select 757 from dual union all
select 761 from dual union all
select 769 from dual union all
select 773 from dual union all
select 787 from dual union all
select 797 from dual union all
select 809 from dual union all
select 811 from dual union all
select 821 from dual union all
select 823 from dual union all
select 827 from dual union all
select 829 from dual union all
select 839 from dual union all
select 853 from dual union all
select 857 from dual union all
select 859 from dual union all
select 863 from dual union all
select 877 from dual union all
select 881 from dual union all
select 883 from dual union all
select 887 from dual union all
select 907 from dual union all
select 911 from dual union all
select 919 from dual union all
select 929 from dual union all
select 937 from dual union all
select 941 from dual union all
select 947 from dual union all
select 953 from dual union all
select 967 from dual union all
select 971 from dual union all
select 977 from dual union all
select 983 from dual union all
select 991 from dual union all
select 997 from dual union all
select 1009 from dual union all
select 1013 from dual union all
select 1019 from dual union all
select 1021 from dual union all
select 1031 from dual union all
select 1033 from dual union all
select 1039 from dual union all
select 1049 from dual union all
select 1051 from dual union all
select 1061 from dual union all
select 1063 from dual union all
select 1069 from dual union all
select 1087 from dual union all
select 1091 from dual union all
select 1093 from dual union all
select 1097 from dual union all
select 1103 from dual union all
select 1109 from dual union all
select 1117 from dual union all
select 1123 from dual union all
select 1129 from dual union all
select 1151 from dual union all
select 1153 from dual union all
select 1163 from dual union all
select 1171 from dual union all
select 1181 from dual union all
select 1187 from dual union all
select 1193 from dual union all
select 1201 from dual union all
select 1213 from dual union all
select 1217 from dual union all
select 1223 from dual union all
select 1229 from dual union all
select 1231 from dual union all
select 1237 from dual union all
select 1249 from dual union all
select 1259 from dual union all
select 1277 from dual union all
select 1279 from dual union all
select 1283 from dual union all
select 1289 from dual union all
select 1291 from dual union all
select 1297 from dual union all
select 1301 from dual union all
select 1303 from dual union all
select 1307 from dual union all
select 1319 from dual union all
select 1321 from dual union all
select 1327 from dual union all
select 1361 from dual union all
select 1367 from dual union all
select 1373 from dual union all
select 1381 from dual union all
select 1399 from dual union all
select 1409 from dual union all
select 1423 from dual),-- 3~sqrt(2E10/1E4=2000000)的素数表,用来判断a.p,b.p是否素数的整数倍,2不用判断
pr as (select 9999+level*2 p from dual connect by level<=650000),--大的奇数因数 10001~2000000
pr2 as (select 9999+level*2 p from dual connect by level<=(141439-9999)/2)--小的奇数因数 10001~141439
select a.p,b.p,a.p*b.p n from pr a,pr2 b
where a.p>=b.p
and b.p>=130E8/a.p and b.p<=131E8/a.p
and substr(to_char(a.p*b.p),2,1)IN('3','5','8')
--and not exists(select 1 from sp c where mod(a.p,c.s)=0)
--and not exists(select 1 from sp c where mod(b.p,c.s)=0)
and not exists(select 1 from sp c where c.s<=a.p/3 and mod(a.p,c.s)=0)
and not exists(select 1 from sp c where c.s<=b.p/3 and mod(b.p,c.s)=0)
/*假定是中国手机号都是1开头*/
and a.p*b.p>=130E8 and a.p*b.p<131E8
and instr(to_char(a.p*b.p),'0')>1
--and instr(to_char(a.p*b.p),'1')>1 /*第一位必须是1,因此不用判断*/
and instr(to_char(a.p*b.p),'2')>1
and instr(to_char(a.p*b.p),'3')>1
and instr(to_char(a.p*b.p),'4')>1
and instr(to_char(a.p*b.p),'5')>1
and instr(to_char(a.p*b.p),'6')>1
and instr(to_char(a.p*b.p),'7')>1
and instr(to_char(a.p*b.p),'8')>1
and instr(to_char(a.p*b.p),'9')>1
;



分享到:
评论

相关推荐

    手机号码归属地sql(mysql,SQLServer)两个版本

    手机号码归属地sql(mysql,SQLServer)两个版本 insert into app_mobile_attribute_info VALUES (1,"1300000","山东","济南","中国联通","0531","250000" ),(2,"1300001","江苏","常州","中国联通","0519","213000...

    手机号码归属地sql脚步

    标题中的“手机号码归属地sql脚步”指的是一个用于查询或获取手机号码归属地的SQL脚本。这样的脚本通常在数据库管理系统(如MySQL、SQL Server、Oracle等)中使用,通过对手机号码进行特定的查询操作,可以找出号码...

    手机号码归属地数据库sql文件

    综上所述,“extend_mobile.sql”文件提供了一个完整的手机号码归属地数据库结构和数据,通过导入到MySQL,可以方便地进行手机号码的归属地查询和相关分析,为各种业务场景提供支持。在实际应用中,我们需要关注数据...

    手机号码归属地数据库(SQL)

    1. **数据库表结构**:手机号码归属地数据库的核心是设计一个合理的表结构,通常包含以下字段: - `phone_number`:存储手机号码,可能需要进行预处理,如去除特殊字符或前缀。 - `province`:归属省份,便于识别...

    手机号码归属MySQL数据库SQL文件

    手机号码归属MySQL数据库SQL文件(14M): 导出命令: mysqldump -uroot -p123456 test t_mobilephone_number &gt; /root/mobilephoneNumber.sql 手机号码段:13*;15*;145、147、186、187、188、189 包含记录数:...

    2018手机号码归属地sql

    - **手机号码归属地查询服务**: 可以基于此数据库构建一个手机号码归属地查询系统,用户输入手机号码后,系统能够快速返回其对应的省份、城市和运营商等信息。 - **数据分析**: 此类数据可用于分析不同地区用户的...

    手机号码归属地查询sql

    手机号码归属地查询sql,数据库导入,便捷高效,需要的同学自行下载 手机号码归属地查询sql,数据库导入,便捷高效,需要的同学自行下载 手机号码归属地查询sql,数据库导入,便捷高效,需要的同学自行下载 手机号码...

    全国手机号码归属地数据库sql

    全国手机号码归属地数据库 我已经把数据整成了sql语句,下载后只需要把sql语句执行一下就可了 数据总数 273683条 电信133 -&gt; 9623 电信153 -&gt; 9787 电信180 -&gt; 9335 电信189 -&gt; 9958 电信181 -&gt; 4743 移动134 -&gt; ...

    手机号码归属地数据库SQL

    截止2013年5月, 手机号码归属地数据库SQL,支持多种数据库,本人主要使用在mysql

    根据手机号码查询所在地.sql

    全国的根据手机号码查询省市区的数据例如: insert into `ibs_exh_mobile_city`(`id`,`pre_mobile`,`province`,`city`,`mno`,`pre_tel`,`post_code`,`pre_head`,`province_id`,`city_id`) values (1,'1300000',...

    手机号码归属地.sql

    不需要重新建表,重新填写数据,直接导入navicat执行即可,2019年的数据,还是挺全的,拿走不谢

    sql手机销售管理系统

    【SQL手机销售管理系统】是一个基于SQL语言设计的用于管理手机销售流程的应用。系统的主要目标是让学生运用已学习的SQL知识,掌握数据库开发的基本步骤,并熟悉SQL语言的数据操作,包括查询、修改、插入和删除。 在...

    2020完整全国号码归属地sql文件

    2020年全国号码归属地,数据库sql文本,22W+数据资源

    自己做的ASP+SQL手机网站

    在本项目中,"自己做的ASP+SQL手机网站"展示了一个基于ASP技术构建的、适用于移动设备的网站实例。 SQL(Structured Query Language)是用于管理和处理关系数据库的标准语言。在ASP中,SQL通常与数据库连接组件如...

    手机号码段全国归属地数据库(共360569条记录)txt文件和sql文件

    全国手机号码段归属地数据库是一个重要的资源,尤其对于IT专业人士来说,它提供了关于手机号码归属地的详尽信息。这个数据库包含360569条记录,这意味着它覆盖了非常广泛的电话号码范围,不仅包括传统的移动、电信和...

    JSP+SQL手机销售系统

    本文将深入探讨一个基于JSP(JavaServer Pages)和SQL Server技术构建的手机销售系统,旨在揭示其核心功能和实现机制。 JSP是Java平台上的动态网页开发技术,它结合了HTML、CSS和Java代码,使得开发者可以方便地...

    最新手机号码归属地数据库(sql导入+csv格式化文件)

    这种文件包含了创建表结构和填充数据的SQL语句,用户可以直接在数据库中运行这些语句,快速构建一个完整的手机号码归属地表。使用SQL导入文件的优点是能够确保数据结构的一致性和完整性,同时便于进行数据更新和维护...

    全美经典-SQL编程习题与解答

    全美经典-SQL编程习题与解答全美经典-SQL编程习题与解答全美经典-SQL编程习题与解答全美经典-SQL编程习题与解答

    ASP+SQL游戏系统

    母版页是ASP.NET中的一个重要特性,它提供了一种统一网站布局的方法。在游戏网站中,母版页可以定义全局导航、头部和底部等共享元素,各个页面继承母版页后,只需关注各自的具体内容,从而提高开发效率和界面一致性...

    手机销售系统 手机销售系统 C#+sql手机销售系统 C#+sql

    手机销售系统是一款基于C#编程语言和SQL数据库技术开发的应用程序,主要用于管理和优化手机零售业务。C#是一种现代化、面向对象的编程语言,由微软公司推出,广泛应用于Windows平台的软件开发,尤其在企业级应用中...

Global site tag (gtag.js) - Google Analytics