query
a pythonic query language
Sign in or create a new account.


R(n@1) R(r@1) R(b@1)
7 4 2
9 7 2
25 21 2
27 19 2
81 55 2
121 111 2
125 101 2
169 157 2
243 163 2
361 343 2
625 501 2
729 487 2
841 813 2
4 3 3
25 21 3
49 43 3
125 101 3
289 273 3
343 295 3
361 343 3
625 501 3
841 813 3
961 931 3
3 2 4
5 3 4
7 4 4
9 7 5
27 19 5
49 43 5
81 55 5
243 163 5
289 273 5
343 295 5
529 507 5
729 487 5
121 111 6
169 157 6
289 273 6
3 2 7
4 3 7
121 111 7
169 157 7
289 273 7
529 507 7
6 4 8
25 21 8
121 111 8
125 101 8
625 501 8
841 813 8
5 3 9
7 4 9

Parameters:
b, n, r

The PyQL query format is: fields @ conditions.
  fields is a field or a comma delimited list of fields.
 conditions is a condition or an and delimited list of conditions.

Both fields and conditions are made up of terms.
A term is a valid Python expression in a name space made up of: database parameters; any imported python modules; PyQL Aggregators such as Average (A), Sum (S), and Replace (R); and other domain specific terms.

About the Barely Rational DatabaseSample Queries
n are integers from 2 to 1001.

r is the number of 'digits' required to represent 1/n (+1 for the bar).

b is the base.

Primes is a list of prime numbers.

To see n vs r in base 10, use the PyQL:
n,r@b=10

To see n vs r for bases 2 - 10, use the PyQL:
n,r@b and b<=10

To see n vs r for bases 2 - 10 for prime n, use the PyQL:
n,r@b and b<=10 and n in Primes

To see n vs r for bases 2 - 10 with icons colored by primeness, use the PyQL:
n,r@b and b<=10 and (n in Primes),(n not in Primes)

To see n v r/n for bases 2 - 10 with icons colored by primeness, use the PyQL:
n,r/n@b and b<=10 and (n in Primes),(n not in Primes)

To see n v r/n with icons colored by primeness for bases that are perfect squares, use the PyQL:
n,r/n@b and math.pow(b,0.5)=int(math.pow(b,0.5)) and (n in Primes),(n not in Primes)

n v math.log(r/n) seems to have something to tell us:
n,math.log(r/n)@b and b<=10 and (n in Primes),(n not in Primes)

What about those dots between the main lines in these graphics? Are there patterns to those barely rational numbers? Let's have a peek with a histogram:
n@0.55<r/n<1 and n<100
Hmmm, 81, 49, 27 and 25 are well represented.

We can have a closer look with that most excellent data visualization tool called a table of numbers:
S(1),R(n)@0.55<r/n<1 and n
And we see that those middling dots come from powers of primes the 4 most common values of n being squares of 17,29,23 and 11. Cubes of primes are also well represented at 125, 343, 27 and 729.

Another nice query is:
R(n),R(r),R(b)@0.55<r/n<1 and r and n and b and b<10
1/9 repeats after 6 digits in bases 2 and 5. Likewise for bases 2, 3 and 8 where 1/841 repeats after 812 digits. How interesting!

Let's continue to graphically explore the cases of non-integer n/r. To start, let's look at n/r between 1 and 2 with the PyQL:
n,n/r,(n,r)@1<n/r<2

There is a lot going on there and and coloring by oddness reveals a pattern:
n,n/r,(n,r)@b<=200 and 1<n/r<2 and (n/2.=int(n/2.)),(n/2.!=int(n/2.))

Grouping by n being a perfect square shows in interesting set of numbers.
n,n/r,(n,r)@1<n/r<2 and (int(math.pow(n,0.5))=math.pow(n,0.5)) as 'perfect square',(int(math.pow(n,0.5))!=math.pow(n,0.5)) as 'not perfect square'