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


b = 10
n r
2 1
3 2
4 2
5 1
6 3
7 7
8 3
9 2
10 1
11 3
12 3
13 7
14 7
15 2
16 3
17 17
18 2
19 19
20 1
21 7
22 3
23 23
24 4
25 1
26 7
27 4
28 8
29 29
30 2
31 16
32 4
33 3
34 17
35 7
36 3
37 4
38 19
39 7
40 2
41 6
42 7
43 22
44 4
45 2
46 23
47 47
48 5
49 43
50 1
51 17
52 8
53 14
54 4
55 3
56 9
57 19
58 29
59 59
60 3
61 61
62 16
63 7
64 5
65 7
66 3
67 34
68 18
69 23
70 7
71 36
72 4
73 9
74 4
75 3
76 19
77 7
78 7
79 14
80 3
81 10
82 6
83 42
84 8
85 17
86 22
87 29
88 5
89 45
90 2
91 7
92 23
93 16
94 47
95 19
96 6
97 97
98 43
99 3
100 1
101 5
102 17
103 35
104 8
105 7
106 14
107 54
108 4
109 109
110 3
111 4
112 9
113 113
114 19
115 23
116 29
117 7
118 59
119 49
120 3
121 23
122 61
123 6
124 16
125 1
126 7
127 43
128 5
129 22
130 7
131 131
132 3
133 19
134 34
135 4
136 17
137 9
138 23
139 47
140 7
141 47
142 36
143 7
144 4
145 29
146 9
147 43
148 4
149 149
150 2
151 76
152 19
153 17
154 7
155 16
156 7
157 79
158 14
159 14
160 3
161 67
162 10
163 82
164 6
165 3
166 42
167 167
168 8
169 79
170 17
171 19
172 22
173 44
174 29
175 7
176 5
177 59
178 45
179 179
180 2
181 181
182 7
183 61
184 24
185 4
186 16
187 17
188 47
189 7
190 19
191 96
192 6
193 193
194 97
195 7
196 43
197 99
198 3
199 100
200 1
201 34
202 5
203 85
204 17
205 6
206 35
207 23
208 10
209 19
210 7
211 31
212 14
213 36
214 54
215 22
216 5
217 31
218 109
219 9
220 3
221 49
222 4
223 223
224 10
225 2
226 113
227 114
228 19
229 229
230 23
231 7
232 29
233 233
234 7
235 47
236 59
237 14
238 49
239 8
240 4
241 31
242 23
243 28
244 61
245 43
246 6
247 19
248 18
249 42
250 1
251 51
252 7
253 23
254 43
255 17
256 6
257 257
258 22
259 7
260 7
261 29
262 131
263 263
264 4
265 14
266 19
267 45
268 34
269 269
270 4
271 6
272 18
273 7
274 9
275 3
276 23
277 70
278 47
279 16
280 8
281 29
282 47
283 142
284 36
285 19
286 7
287 31
288 5
289 273
290 29
291 97
292 9
293 147
294 43
295 59
296 5
297 7
298 149
299 67
300 2
301 43
302 76
303 5
304 20
305 61
306 17
307 154
308 7
309 35
310 16
311 156
312 8
313 313
314 79
315 7
316 14
317 80
318 14
319 29
320 4
321 54
322 67
323 145
324 10
325 7
326 82
327 109
328 6
329 139
330 3
331 111
332 42
333 4
334 167
335 34
336 9
337 337
338 79
339 113
340 17
341 31
342 19
343 295
344 22
345 23
346 44
347 174
348 29
349 117
350 7
351 7
352 7
353 33
354 59
355 36
356 45
357 49
358 179
359 180
360 3
361 343
362 181
363 23
364 7
365 9
366 61
367 367
368 24
369 6
370 4
371 79
372 16
373 187
374 17
375 3
376 47
377 85
378 7
379 379
380 19
381 43
382 96
383 383
384 6
385 7
386 193
387 22
388 97
389 389
390 7
391 177
392 43
393 131
394 99
395 14
396 3
397 100
398 100
399 19
400 2
401 201
402 34
403 31
404 5
405 10
406 85
407 7
408 18
409 205
410 6
411 9
412 35
413 175
414 23
415 42
416 10
417 47
418 19
419 419
420 7
421 141
422 31
423 47
424 14
425 17
426 36
427 61
428 54
429 7
430 22
431 216
432 6
433 433
434 31
435 29
436 109
437 199
438 9
439 220
440 4
441 43
442 49
443 222
444 4
445 45
446 223
447 149
448 11
449 33
450 2
451 11
452 113
453 76
454 114
455 7
456 19
457 153
458 229
459 49
460 23
461 461
462 7
463 155
464 30
465 16
466 233
467 234
468 7
469 67
470 47
471 79
472 59
473 43
474 14
475 19
476 49
477 14
478 8
479 240
480 5
481 7
482 31
483 67
484 23
485 97
486 28
487 487
488 61
489 82
490 43
491 491
492 6
493 113
494 19
495 3
496 18
497 211
498 42
499 499
500 1
501 167
502 51
503 503
504 8
505 5
506 23
507 79
508 43
509 509
510 17
511 25
512 7
513 19
514 257
515 35
516 22
517 47
518 7
519 44
520 8
521 53
522 29
523 262
524 131
525 7
526 263
527 241
528 5
529 507
530 14
531 59
532 19
533 31
534 45
535 54
536 34
537 179
538 269
539 43
540 4
541 541
542 6
543 181
544 19
545 109
546 7
547 92
548 9
549 61
550 3
551 253
552 23
553 79
554 70
555 4
556 47
557 279
558 16
559 43
560 9
561 17
562 29
563 282
564 47
565 113
566 142
567 19
568 36
569 285
570 19
571 571
572 7
573 96
574 31
575 23
576 5
577 577
578 273
579 193
580 29
581 247
582 97
583 27
584 10
585 7
586 147
587 294
588 43
589 91
590 59
591 99
592 5
593 593
594 7
595 49
596 149
597 100
598 67
599 300
600 3
601 301
602 43
603 34
604 76
605 23
606 5
607 203
608 22
609 85
610 61
611 139
612 17
613 52
614 154
615 6
616 7
617 89
618 35
619 619
620 16
621 67
622 156
623 133
624 8
625 2
626 313
627 19
628 79
629 49
630 7
631 316
632 15
633 31
634 80
635 43
636 14
637 43
638 29
639 36
640 5
641 33
642 54
643 108
644 67
645 22
646 145
647 647
648 11
649 59
650 7
651 31
652 82
653 327
654 109
655 131
656 8
657 9
658 139
659 659
660 3
661 221
662 111
663 49
664 42
665 19
666 4
667 309
668 167
669 223
670 34
671 61
672 10
673 225
674 337
675 4
676 79
677 339
678 113
679 97
680 18
681 114
682 31
683 342
684 19
685 9
686 295
687 229
688 23
689 79
690 23
691 231
692 44
693 7
694 174
695 47
696 29
697 81
698 117
699 233
700 7
701 701
702 7
703 19
704 7
705 47
706 33
707 13
708 59
709 709
710 36
711 14
712 45
713 331
714 49
715 7
716 179
717 8
718 180
719 360
720 4
721 103
722 343
723 31
724 181
725 29
726 23
727 727
728 7
729 82
730 9
731 337
732 61
733 62
734 367
735 43
736 26
737 67
738 6
739 247
740 4
741 19
742 79
743 743
744 16
745 149
746 187
747 42
748 17
749 319
750 3
751 126
752 48
753 51
754 85
755 76
756 7
757 28
758 379
759 23
760 19
761 381
762 43
763 109
764 96
765 17
766 383
767 175
768 7
769 193
770 7
771 257
772 193
773 194
774 22
775 16
776 97
777 7
778 389
779 91
780 7
781 71
782 177
783 85
784 44
785 79
786 131
787 394
788 99
789 263
790 14
791 337
792 4
793 61
794 100
795 14
796 100
797 200
798 19
799 369
800 3
801 45
802 201
803 9
804 34
805 67
806 31
807 269
808 6
809 203
810 10
811 811
812 85
813 6
814 7
815 82
816 18
817 127
818 205
819 7
820 6
821 821
822 9
823 823
824 35
825 3
826 175
827 414
828 23
829 277
830 42
831 70
832 11
833 337
834 47
835 167
836 19
837 16
838 419
839 420
840 8
841 813
842 141
843 29
844 31
845 79
846 47
847 67
848 16
849 142
850 17
851 67
852 36
853 214
854 61
855 19
856 54
857 857
858 7
859 27
860 22
861 31
862 216
863 863
864 7
865 44
866 433
867 273
868 31
869 27
870 29
871 67
872 109
873 97
874 199
875 8
876 9
877 439
878 220
879 147
880 5
881 441
882 43
883 442
884 49
885 59
886 222
887 887
888 5
889 43
890 45
891 19
892 223
893 415
894 149
895 179
896 12
897 67
898 33
899 421
900 2
901 209
902 11
903 43
904 113
905 181
906 76
907 152
908 114
909 5
910 7
911 456
912 21
913 83
914 153
915 61
916 229
917 391
918 49
919 460
920 23
921 154
922 461
923 211
924 7
925 4
926 155
927 35
928 31
929 465
930 16
931 127
932 233
933 156
934 234
935 17
936 7
937 937
938 67
939 313
940 47
941 941
942 79
943 111
944 61
945 7
946 43
947 474
948 14
949 25
950 19
951 80
952 49
953 953
954 14
955 96
956 8
957 29
958 240
959 25
960 6
961 466
962 7
963 54
964 31
965 193
966 67
967 323
968 23
969 145
970 97
971 971
972 28
973 139
974 487
975 7
976 63
977 977
978 82
979 45
980 43
981 109
982 491
983 983
984 6
985 99
986 113
987 139
988 19
989 463
990 3
991 496
992 19
993 111
994 211
995 100
996 42
997 167
998 499
999 4
1000 1

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 in base 10 graphically, 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'