# “How many different integers does this give us?”

How many unique integers can you get from $\lceil2012/n\rceil$ where $n$ is a positive integer?

I don't know at all where to begin to approach this problem. I thought it maybe had something to do with which factors the number has or anything like that, but I couldn't find any obvious pattern.

-
Did you try any examples with smaller numbers? for example $\lceil12/n\rceil$,$\lceil14/n\rceil$ ? – Dennis Gulko Sep 25 '12 at 12:23
I did try that, in particular with prime numbers. – Andre Hansen Sep 25 '12 at 12:55

If the difference

$$\frac{2012}n-\frac{2012}{n+1}=\frac{2012}{n(n+1)}$$

is less than $1$, then there cannot be an integer between $\lceil2012/(n+1)\rceil$ and $\lceil2012/n\rceil$; whereas if the difference is greater than $1$, then $\lceil2012/(n+1)\rceil$ and $\lceil2012/n\rceil$ cannot be equal. The crossover happens between $n=44$ and $n=45$. Thus the $44$ values for $n=1$ to $n=44$ are all distinct, and the integers $n\ge45$ exactly cover the $45$ values from $1$ to $\lceil2012/45\rceil=45$, for a total of $44+45=89$ different values.

-
As absurd as it sounds, I understand everything about this except for the simplification of their difference. I've never heard of that thing, what's it called? – Andre Hansen Sep 25 '12 at 12:57
@Andre: Bring the two fractions onto a common denominator by expanding the first one with $n+1$ and the second one with $n$. Then the terms proportional to $n$ in the numerator cancel, and only the $2012$ remains. (You can also first factor out $2012$ to simplify things.) – joriki Sep 25 '12 at 12:59
Oh, now I see. How did I miss that... – Andre Hansen Sep 25 '12 at 13:01

Here is a program that will print 89 like @joriki said!!

class Program
{

static void Main(string[] args)
{
int n = 1,c=0;
double prev = 0;
for (n = 1 ; n <= 2012; n++)
{
double curr=Math.Ceiling((double)2012/n);
if (prev != curr) c++;
//Console.WriteLine(curr.ToString());
prev=curr;
}
Console.WriteLine(c.ToString());
}
}

-

In GAP it's three lines of code :

LoadPackage("numericalsgps");;
Set(List([1..2012],n->CeilingOfRational(2012/n)));
Size(last);


(albeit with one fairly redundant line of code). This outputs:

[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 55, 56, 58, 60, 61, 63, 65,
68, 70, 72, 75, 78, 81, 84, 88, 92, 96, 101, 106, 112, 119, 126, 135, 144,
155, 168, 183, 202, 224, 252, 288, 336, 403, 503, 671, 1006, 2012 ]


and the number of results:

89

-

This is no way a solution to the problem. I was just trying to identify the pattern using Java 7 code.

public class FloorTest {

public static void main(String[] args) {
Map<Integer, Set<Integer>> map = new TreeMap<>();
for (int i = 1; i < 2500; i++) {
Set<Integer> set = new TreeSet<>();
for (int j = 1; j <= 2 * i + 2; j++) {
int i_j = i / j;
int ceil = (j * i_j < i) ? i_j + 1 : i_j;

}

Set<Integer> valueSet = map.get(set.size());
if (valueSet == null) {
valueSet = new TreeSet<>();
map.put(set.size(), valueSet);
}
}

Set<Entry<Integer, Set<Integer>>> entrySet = map.entrySet();
for (Entry<Integer, Set<Integer>> entry : entrySet) {
Set<Integer> values = entry.getValue();
System.out.println("\nnumber of unique solutions:" + entry.getKey()
+ " for " + values.size() + " numbers:" + entry.getValue());
}

}


}

According to the result,

There will be

2n-1 unique solutions for n consecutive numbers $[n(n-1)+1,\cdots,n^2]$

and 2n unique solutions for n consecutive numbers $[n^2+1,\cdots,n(n+1)]$.

For $2012,n=45$ as $n(n-1)+1=1981$ as $n^2=2025$.

A snippet of the result follows:

number of unique solutions:87 for 44 numbers:[1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936]

number of unique solutions:88 for 44 numbers:[1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980]

number of unique solutions:89 for 45 numbers:[1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025]

number of unique solutions:90 for 45 numbers:[2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070]

number of unique solutions:91 for 46 numbers:[2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116]

-