Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 49820

Number theory involves properties and relationships of numbers, primarily positive integers.

5 votes

Reverse and subtract

Oracle SQL 11.2, 136 bytes WITH v(n)AS(SELECT :1 FROM DUAL UNION ALL SELECT ABS(n-REVERSE(n||''))FROM v WHERE n>0)CYCLE n SET c TO 0 DEFAULT 1 SELECT MIN(c)FROM v; Un-golfed WITH v(n) AS ( SEL …
Jeto's user avatar
  • 1,701
4 votes

Generate lazy values

Oracle SQL 11.2, 200 bytes WITH v(i)AS(SELECT 0 FROM DUAL UNION ALL SELECT DECODE(SIGN(i),0,-1,-1,-i,-i-1)FROM v WHERE LENGTH(REGEXP_REPLACE(:1+i,'([0-9])\1+','\1'))>1)SELECT:1+MIN(i)KEEP(DENSE_RANK L …
Jeto's user avatar
  • 1,701
4 votes

Implement the divisibility-by-7 rule

Oracle SQL 11.2, 116 bytes WITH v(i)AS(SELECT:1 FROM DUAL UNION ALL SELECT TRUNC(i/10)-(i-TRUNC(i,-1))*2 FROM v WHERE i>70)SELECT MIN(i)FROM v; Un-golfed WITH v(i) AS ( SELECT :1 FROM DUAL UNION …
Jeto's user avatar
  • 1,701
2 votes

Greatest Common Divisor

Oracle SQL 11.2, 104 118 bytes SELECT MAX(:1+:2-LEVEL+1)FROM DUAL WHERE(MOD(:1,:1+:2-LEVEL+1)+MOD(:2,:1+:2-LEVEL+1))*:1*:2=0 CONNECT BY LEVEL<=:1+:2; Fixed for input of 0
Jeto's user avatar
  • 1,701
2 votes

Is this number a prime?

Oracle SQL 11.2, 73 bytes SELECT SUM(DECODE(MOD(:1,LEVEL),0,1,0))-2 FROM DUAL CONNECT BY LEVEL<=:1; Return 0 if prime, any other value is false
Jeto's user avatar
  • 1,701
2 votes

Output the Juggler sequence

Oracle SQL 11.2, 128 bytes WITH v(i)AS(SELECT :1 FROM DUAL UNION ALL SELECT FLOOR(DECODE(MOD(i,2),0,SQRT(i),POWER(i,1.5)))FROM v WHERE i>1)SELECT i FROM v; Un-golfed WITH v(i) AS ( SELECT :1 FROM D …
Jeto's user avatar
  • 1,701
1 vote

Print the Super Collatz numbers

Oracle SQL 11.2, 329 bytes WITH q(s,i)AS(SELECT LEVEL s,LEVEL i FROM DUAL CONNECT BY LEVEL<=:1 UNION ALL SELECT s,DECODE(MOD(i,2),0,i/2,i*3+1)i FROM q WHERE i<>1),v AS(SELECT s,COUNT(*)-1 d FROM q GRO …
Jeto's user avatar
  • 1,701