$$ R= \left\{ n(n+1)/2 \bmod 2020: n\in\mathbb{N}  \right\} $$ It can be verified that $2\notin R$ by this Python code: list(set([n*(n+1)//2 % 2020 for n in range(1, 2020)]))  whose output is [0, 1, 3, 6, 8, 10, 13, 15, 21, 23, 25, 28, 31, 35, 36, 45, 48, 51, 53, 55, 56, 60, 61, 63, 65, 66, 70, 71, 73, 75, 78, 81, 90, 91, 95, 98, 101, 103, 105, 111, 113, 116, 118, 120, 123, 125, 126, 130, 135, 136, 138, 146, 153, 156, 161, 166, 171, 175, 176, 190, 191, 193, 196, 198, 203, 205, 206, 208, 210, 215, 221, 223, 225, 226, 230, 231, 233, 236, 238, 250, 253, 255, 258, 263, 265, 268, 273, 275, 276, 280, 283, 291, 293, 300, 303, 305, 306, 311, 313, 315, 316, 318, 320, 325, 326, 328, 331, 338, 340, 348, 351, 355, 356, 358, 363, 366, 368, 373, 376, 378, 381, 393, 395, 398, 400, 401, 405, 406, 408, 410, 416, 421, 423, 425, 426, 428, 433, 435, 438, 440, 441, 455, 456, 460, 465, 470, 475, 478, 485, 493, 495, 496, 501, 505, 506, 508, 511, 513, 515, 518, 520, 526, 528, 530, 533, 536, 540, 541, 550, 553, 556, 558, 560, 561, 565, 566, 568, 570, 571, 575, 576, 578, 580, 583, 586, 595, 596, 600, 603, 606, 608, 610, 616, 618, 621, 623, 625, 628, 630, 631, 635, 640, 641, 643, 651, 658, 661, 666, 671, 676, 680, 681, 695, 696, 698, 701, 703, 708, 710, 711, 713, 715, 720, 726, 728, 730, 731, 735, 736, 738, 741, 743, 755, 758, 760, 763, 768, 770, 773, 778, 780, 781, 785, 788, 796, 798, 805, 808, 810, 811, 816, 818, 820, 821, 823, 825, 830, 831, 833, 836, 843, 845, 853, 856, 860, 861, 863, 868, 871, 873, 878, 881, 883, 886, 898, 900, 903, 905, 906, 910, 911, 913, 915, 921, 926, 928, 930, 931, 933, 938, 940, 943, 945, 946, 960, 961, 965, 970, 975, 980, 983, 990, 998, 1000, 1001, 1006, 1010, 1011, 1013, 1016, 1018, 1020, 1023, 1025, 1031, 1033, 1035, 1038, 1041, 1045, 1046, 1055, 1058, 1061, 1063, 1065, 1066, 1070, 1071, 1073, 1075, 1076, 1080, 1081, 1083, 1085, 1088, 1091, 1100, 1101, 1105, 1108, 1111, 1113, 1115, 1121, 1123, 1126, 1128, 1130, 1133, 1135, 1136, 1140, 1145, 1146, 1148, 1156, 1163, 1166, 1171, 1176, 1181, 1185, 1186, 1200, 1201, 1203, 1206, 1208, 1213, 1215, 1216, 1218, 1220, 1225, 1231, 1233, 1235, 1236, 1240, 1241, 1243, 1246, 1248, 1260, 1263, 1265, 1268, 1273, 1275, 1278, 1283, 1285, 1286, 1290, 1293, 1301, 1303, 1310, 1313, 1315, 1316, 1321, 1323, 1325, 1326, 1328, 1330, 1335, 1336, 1338, 1341, 1348, 1350, 1358, 1361, 1365, 1366, 1368, 1373, 1376, 1378, 1383, 1386, 1388, 1391, 1403, 1405, 1408, 1410, 1411, 1415, 1416, 1418, 1420, 1426, 1431, 1433, 1435, 1436, 1438, 1443, 1445, 1448, 1450, 1451, 1465, 1466, 1470, 1475, 1480, 1485, 1488, 1495, 1503, 1505, 1506, 1511, 1515, 1516, 1518, 1521, 1523, 1525, 1528, 1530, 1536, 1538, 1540, 1543, 1546, 1550, 1551, 1560, 1563, 1566, 1568, 1570, 1571, 1575, 1576, 1578, 1580, 1581, 1585, 1586, 1588, 1590, 1593, 1596, 1605, 1606, 1610, 1613, 1616, 1618, 1620, 1626, 1628, 1631, 1633, 1635, 1638, 1640, 1641, 1645, 1650, 1651, 1653, 1661, 1668, 1671, 1676, 1681, 1686, 1690, 1691, 1705, 1706, 1708, 1711, 1713, 1718, 1720, 1721, 1723, 1725, 1730, 1736, 1738, 1740, 1741, 1745, 1746, 1748, 1751, 1753, 1765, 1768, 1770, 1773, 1778, 1780, 1783, 1788, 1790, 1791, 1795, 1798, 1806, 1808, 1815, 1818, 1820, 1821, 1826, 1828, 1830, 1831, 1833, 1835, 1840, 1841, 1843, 1846, 1853, 1855, 1863, 1866, 1870, 1871, 1873, 1878, 1881, 1883, 1888, 1891, 1893, 1896, 1908, 1910, 1913, 1915, 1916, 1920, 1921, 1923, 1925, 1931, 1936, 1938, 1940, 1941, 1943, 1948, 1950, 1953, 1955, 1956, 1970, 1971, 1975, 1980, 1985, 1990, 1993, 2000, 2008, 2010, 2011, 2016]  But an approach without brute-force calculation is expected.
The sequence of triangular numbers is well known. Consider now the triangular numbers modulo some positive natural number $k$. That is, let $T_{n,k}$ be the remainder of dividing $T_n$ by $k$. For the regular sequence of triangular numbers, we can take as convention $T_n = T_{n, \infty}$.  Question: For all values of $k, i &lt; k$, does there exists some $n$ such that $T_{n, k} = i$
Bash script doesn't see SIGHUP? I've got the following script:  #!/bin/bash echo "We are $$" trap "echo HUP" SIGHUP cat    # wait indefinitely   When I send SIGHUP (using kill -HUP pid), nothing happens.  If I change the script slightly:  #!/bin/bash echo "We are $$" trap "kill -- -$BASHPID" EXIT    # add this trap "echo HUP" SIGHUP cat    # wait indefinitely   ...then the script does the echo HUP thing right as it exits (when I press Ctrl+C):  roger@roger-pc:~ $ ./hupper.sh  We are 6233 ^CHUP   What's going on? How should I send a signal (it doesn't necessarily have to be SIGHUP) to this script? How to list all functions in a Python module? I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it. I want to call the help function on each one. In Ruby I can do something like ClassName.methods to get a list of all the methods available on that class. Is there something similar in Python? eg. something like: from somemodule import foo print(foo.methods)  # or whatever is the correct method to call Override iTunes "media" keys (play, pause, etc) for Spotify? Stopping all automatic updates Windows 10 We've upgraded some machines to Windows 10 and realized there were some updates which updated as required. However, I realized there was no option available to stop the download similar to that on Windows 7 and 8.1. The only way I could stop the download was to stop the Windows Update service.  My question is does anyone know of a way to stop auto updates or is stopping the service is the only solution? What are the alternatives to the FHS? I'm a long time Linux user for over 15 years but one thing I hate with a passion is the mandated directory structure. I don't like that /usr/bin is the dumping ground for binaries or libs in /usr/lib, /usr/lib32, /usr/libx32, /lib, /lib32 etc... Random stuff in /usr/share etc. It's dumb and confusing. But some like it and tastes differ.  I want a directory structure where each package is isolated. Imagine instead if the media player dragon had it's own structure:  /software/dragon /software/dragon/bin/x86/dragon /software/dragon/doc/README /software/dragon/doc/copyright /software/dragon/lib/x86/libdragon.so   Or:  /software/zlib/include/zlib.h /software/zlib/lib/1.2.8/x86/libz.so /software/zlib/lib/1.2.8/x64/libz.so /software/zlib/doc/examples/... /software/zlib/man/...   You get the point. What are my options? Is there any Linux distro that uses something like my scheme? Can some distro be modified to work like I want it (Gentoo??) or do I need LFS? Is there any prior art in this area? Like publications on if the scheme is feasible or unfeasible?  Not looking for OS X. :) But OS X-inspired is totally ok.  Edit: I have no idea how PATH, LD_LIBRARY_PATH and other environment variables that depend on a small set of paths should work out. I'm thinking that if I have the KDE editor  installed in /software/kate/bin/x86/bin/kate then I'm ok with having to type the full path to the binary to start it. How it should work for dynamic libraries and dlopen calls, I don't know but it can't be an unsolvable engineering problem. Is torque as fundamental a concept as force? I used to think that torque and force were equally “fundamental”. In other words, my understanding was that we usually use Cartesian coordinates in many common problems because it is a convenient system, so as a result instantaneous forces which act in straight lines seem “easier” mathematically but torques require some extra “baggage”. This baggage includes typically teaching that torque is defined in terms of force.  But if say we happened to choose polar coordinates for the problem the situation would appear the other way around. So it would be arbitrary if we chose to define forces in terms of torques instead.  But later on I learned that angular momentum is conserved independently of regular linear momentum (IIRC). Given the definitions of force &amp; torque as derivatives of momentum, this makes it seem much less certain that one should define either torque in terms of force or vice versa — it gives the impression they are more distinct than it first seemed.  That said, as far as I know a lot of physics is about defining &amp; describing “fundamental forces” — not “fundamental torques”.   So is choosing to use either force or torque as the basis of laws &amp; problems arbitrary? Or is there an actual fundamental rationale to when one or the other should be used? On the photos where the lens flare is present, my Nikon D7000 is drawing strange labyrinth-looking artifacts. Here's an example.  The first image is a screenshot of a little part of the original photo zoomed 2:1 in Lightroom.  The second image is the same photo with Lightroom's contrast, clarity and sharpening set to the maximum to make the labyrinth pattern more visible.      This affects only some of the photos presenting lens flare. Here, for instance, the lens flare is present and light conditions are very close to the first photo, but there is no labyrinth pattern, only usual noise (screenshot of a part of a photo at 1:1 with contrast, clarity and sharpening set to the maximum):    Notes:   I can see this pattern only on some of the photos when the sun is in the frame or nearly in the frame. It is present with any lens I tested. The actual photo was shot at f/8, ISO 200, 1/640 s. I've seen this pattern in photos shot at ISO 100 as well. The photo is in RAW format, so this is not a JPEG artifact.   What is that? How do I avoid it? I'm using the caption package.  In the List-Of-Figures I get only the numbers, but I also want to have the prefix. It currently looks like that:     List of Figures   1 Caption of Figure 1........1   2 Caption of Figure 2........9     And I want it to look like:     List of Figures   Figure 1: Caption of Figure 1...1   Figure 2: Caption of Figure 2...9     The same format is already used for the captions themselves. singlespacing in table with no indent How to make excel automatically fill a value in a cell of a sheet when another corresponding cell of another sheet is filled the same value? This discussion informed our process for seven years, but eventually required updates and augmentation. For discussion regarding the successors to this process, please see:    Stack Exchange has some of the best Moderators around — seriously — and that is due in no small part to the communities who scrutinize and vote in our Moderator elections.  We have a rather formal process for electing moderators, but up until now  has been quite informal. On those rare, rare occasion when things just aren't working out, you can see why it becomes such a sticky business to remove someone from a democratically elected position. Our current process is one of &quot;we've got your back.&quot; The Community Team routinely monitors moderator activities, so if a moderator violates the  or fails to uphold the , we can and do intervene. If the disputes and problems persist without resolution, eventually we can ask someone to step down. That's not good enough. We need a much more transparent and prescribed process for when — and more importantly how — to intervene when on-going problems are going unresolved. In urgent situations, we'll step in to protect a site, but ideally the process should be impartial and not subject to accusations of Stack Exchange simply applying undue influence over a community when the whim strikes. The Question: Before we start bouncing around ideas internally, I'd like to hear what you think. What process should be in place to add some checks and balances to deal with higher issues like possible impeachment of a moderator? When and how would such a process come into play? How should such situations be resolved? How do we keep it from being abused? Have at it. This is a round table vetting of ideas. Sum of (example: 0+1+2+3 = 6 , 0+1+2+3+4+5+6+7 = 28 and so on) How do you tell if a D&D book is 3.0 or 3.5? Why is variance squared? How to get selected text from textbox control with javascript Getting JavaScript object key list Is there a way to make the following return true?  string title = "ASTRINGTOTEST"; title.Contains("string");   There doesn't seem to be an overload that allows me to set the case sensitivity.. Currently I UPPERCASE them both, but that's just silly (by which I am referring to the  issues that come with up- and down casing).  UPDATE This question is ancient and since then I have realized I asked for a simple answer for a really vast and difficult topic if you care to investigate it fully. For most cases, in mono-lingual, English code bases  answer will suffice. I'm suspecting because most people coming here fall in this category this is the most popular answer.  answer however brings up the inherent problem that we can't compare text case insensitive until we know both texts are the same culture and we know  what that culture is. This is maybe a less popular answer, but I think it is more correct and that's why I marked it as such. help  displays information about builtin commands. What is the source of help? Does it maintain a database for builtin commands, or does it read some files of each builtin commands (similar to the manpage of each utilities)?  Sometimes I find its information seems to expand that by --help  $ cd --help bash: cd: --: invalid option cd: usage: cd [-L|[-P [-e]]] [dir]  $ help cd cd: cd [-L|[-P [-e]]] [dir]     Change the shell working directory.      Change the current directory to DIR.  The default DIR is the value of the     HOME shell variable.      The variable CDPATH defines the search path for the directory containing     DIR.  Alternative directory names in CDPATH are separated by a colon (:).     A null directory name is the same as the current directory.  If DIR begins     with a slash (/), then CDPATH is not used.      If the directory is not found, and the shell option `cdable_vars' is set,     the word is assumed to be  a variable name.  If that variable has a value,     its value is used for DIR.      Options:         -L  force symbolic links to be followed         -P  use the physical directory structure without following symbolic         links         -e  if the -P option is supplied, and the current working directory         cannot be determined successfully, exit with a non-zero status      The default is to follow symbolic links, as if `-L' were specified.      Exit Status:     Returns 0 if the directory is changed, and if $PWD is set successfully when     -P is used; non-zero otherwise.   I thought help extract the help part of the executable, but for a  python script , it isn't  $ help ./pdf-merge.py bash: help: no help topics match `./pdf-merge.py'.  Try `help help' or `man -k ./pdf-merge.py' or `info ./pdf-merge.py'.  $ ./pdf-merge.py --help usage: pdf-merge.py [-h] [-v] [--ask] [--output OUTPUT] [--title TITLE]                     [--author AUTHOR] [--keyword KEYWORD] [--pdftk PDFTK]                     [--gs GS] [--pdfmarks PDFMARKS] [--unicode]                     PDF [PDF ...]  Merge PDFs preserving bookmarks. Thanks to Larry Cai for suggesting that Unicode be supported and for discussion about the `--pdfmarks` option.  positional arguments:   PDF                  an input PDF to merge  optional arguments:   -h, --help           show this help message and exit   -v, --version        show program's version number and exit   --ask                pause for manual pdfmark tweaking   --output OUTPUT      name of the output PDF   --title TITLE        title of output PDF   --author AUTHOR      author of output PDF   --keyword KEYWORD    keywords for the output PDF   --pdftk PDFTK        path to the pdftk executable   --gs GS              path to the gs (Ghostscript) executable   --pdfmarks PDFMARKS  path to pdfmarks file. If not given, a temporary file                        is used. If given and the file is missing, execution                        will stop after the file is created (before the                        Ghostscript run). If given and the file exists, no                        attempt will be make to use pdftk to generate the mark                        file (I assume your input file is what you want).   --unicode            instead of merging PDFs, convert PDF-formatted unicode                        strings. For example `--unicode '&lt;FEFF03B103B203B3&gt;'                        \u03b1\u03b2\u03b3` How can I list all user names and/or home directories? I want to list all the users dirs on the machine.Usually, I will do:  ls -l /home   But I use it in a script that will be deployed on others machines and maybe on that machines they don't call it home (e.g. myHome). So I want to generalize it to ls -l ~. But it just lists my users home dirs instead of all users home dirs name (basically I want to get a list of the users names on the machine). How can I generalize it? Why am I getting black photos when I use the Manual feature on my DSLR? I was taking photos a few days ago, and I had it set to Manual. After about four photos, the rest started coming out black. I could see through my eyepiece clearly, and it took the photo normally, but when I reviewed it they were all black.