`
l1t
  • 浏览: 824 次
  • 性别: 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版(不齐全骂我)

    标题中的“最新整理手机号码归属地数据库SQL版(不齐全骂我)”暗示了这是一个关于手机号码数据的数据库,使用SQL语言进行管理和操作。这个数据库可能包含了全国或特定区域的手机号码及其对应的归属地信息,但可能并不...

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

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

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

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

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

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

    手机号码归属地.sql

    sql文件,447897条数据(手机号前7位),可直接导入mysql.字段包括省份/城市/邮编/座机号前缀等信息

    手机号码归属地Sql

    手机号码归属地sql 整理好长时间整理好的,分享出来供大家用

    2018手机号码归属地sql

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

    手机号码段省份城市对应表SQL语句

    例如,1380-1389就代表中国移动的一个号码段。 2. **省份**:字段存储了手机号码对应的省份信息,这有助于了解用户的大致地理位置。 3. **城市**:进一步细化了省份内的具体城市,提供更精确的地理位置信息。 ...

    全国手机号码归属地数据库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手机销售管理系统

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

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

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

    sql2008r2风云游戏合区工具

    总的来说,"sql2008r2风云游戏合区工具"是一个专门针对SQL Server 2008 R2的数据库合并解决方案,它结合了数据库管理、数据迁移和游戏运营的特殊需求,通过一系列的工具和脚本帮助游戏开发者高效地进行服务区的合并...

    自己做的ASP+SQL手机网站

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

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

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

    最新最全的手机号码归属地信息SQL

    搜集的最新最全的手机号码归属地信息,支持新开的199,198等号段

    sql去掉最后一个字符

    sql去掉最后一个字符,sql去掉最后一个字符

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

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

Global site tag (gtag.js) - Google Analytics