|
--一个五位数字ABCDE*4=EDCBA,这五个数字不重复
- with a as
- (select level - 1 as x from dual connect by level <= 10)
- select a.x * 10000 + b.x * 1000 + c.x * 100 + d.x * 10 + e.x as y
- from a a, a b, a c, a d, a e
- where a.x > 0
- and (a.x * 10000 + b.x * 1000 + c.x * 100 + d.x * 10 + e.x) * 4 =
- e.x * 10000 + d.x * 1000 + c.x * 100 + b.x * 10 + a.x
- and (a.x <> b.x)
- and (a.x <> c.x and b.x <> c.x)
- and (a.x <> d.x and b.x <> d.x and c.x <> d.x)
- and (a.x <> e.x and b.x <> e.x and c.x <> e.x and d.x <> e.x);
复制代码
- with t as
- (select level-1 as n from dual connect by level <=10)
- select * from t a,t b, t c,t d,t e
- where to_number(a.n||b.n||c.n||d.n||e.n)*4= to_number(reverse(a.n||b.n||c.n||d.n||e.n)) and a.n<>0
复制代码
|
|