Hi, everyone. This is Carol Hinkel, president of Triple E. I want to welcome everyone today to this, our fourth lecture. This topic is very timely. I think it's going to be very, very interesting. I'm excited. So I'd now like to introduce Beth Wood, our program chair, who will give us a little background about our speaker. Beth? Good afternoon, everyone. It's a great pleasure to welcome back to Triple E, Peter Hans Matthews. Dr. Matthews earned his bachelor's degree at McGill, his master's at Queen's University in Kingston, Ontario, and his PhD at Yale. He joined in 1995, the faculty of Middlebury College, where he is currently the Charles A. Dana Professor of Economics. He also serves as a distinguishing visiting professor at also University in Helsinki, Finland. Please join me in welcoming back to Triple E. Dr. Peter Hans Matthews. Hi, everyone. I'm absolutely delighted to be back. I'm hoping that everyone can see the slides over my left shoulder, right shoulder, one of those shoulders. As Beth said, this is a return visit for me. I think the last time I was here, I was talking to all of you about Canadian politics. So this makes a big change. But as I said, I hope that if any of you have any questions in this kind of really different format that you either ask me at the end, or if we don't have time at the end, please feel absolutely free to reach out to me. My email address is on the cover slide here. And I have a web page and I'm pretty easy to find. So all right, so let's get started. I want to start with an observation. And the observation is this. We live in an age of fake news. And even when the news isn't fake, it can be customized or tailored to fit exactly the preferences of people who are like us. And so we have this kind of real splintering effect. And the irony is, is that in the midst of all of this, we have never lived in an age in which there is as much high quality publicly available data as there is right now. There are enormous opportunities for people to become engaged citizens and in fact in much of the world engagement with that kind of data is considered a form of civic engagement. And all of the data and all of the data I'm going to show to you today is publicly available. It comes from and most of it almost all of it comes from three sources and and all of it is, all of it is material or data that any of you could engage with on your own.  There's no reason that we can't enjoy fact based conversations with one another. I'll just mention where the three sets of data come from just so that you have a sense. So, the first is from this really remarkable project called the opportunity insight project insights project at Harvard that by an economist named Raj Chetty. So the project has many dimensions but of late one of the things that they've been doing is they've been in a sense creating an alternative to publicly available government data that is real time that's to say they figured a way to collect data on things like employment or small business activity in real time by partnering with private groups like a credit card processing agencies or job finders and one of the things that they're able to do is they're able to give us a glimps at what's happening to the economy as we speak. So if you want to know what happened to unemployment, not last month, but in some ways last week, the Chetty group is doing remarkable work. The other setup, most of the other pictures I'm going to show you come from something called our world in data, which you just Google our world and that you see it. This is probably the best resource available to any of us in terms of thinking about COVID related data. They also provide useful guidelines. So I encourage you to look at that. The last comes from a very old source but in some ways an underused one, our own Federal Reserve Bank has a something called Fred, which is the kind of the Federal Reserve's economic database. And that's available if you just say Fred Federal Reserve Bank of San Luis. So I just want to say that almost everything I'll show you as a picture almost all of it is publicly available. And almost all of it I think would be interesting to you even without me. So in some ways I'm here to facilitate a conversation that I hope will last a much longer time. All right, so let's start with the first picture. So what are we looking at here. So we're looking at employment. Since the very announcement of the first COVID case in the United States on January 20 of this year. And so the way to interpret this picture is to say on the on horizontally as we move from left to right, but you're looking at our various time with very different dates marked out national emergency declared the cares act enacted the first stimulus payments made up and down what you see is how much total employment in the United States has changed relative to what it was on January 20. So on January 20 at zero, you see just after that it goes up a little bit, and then you see what we all observed namely the crash of employment post the declaration of the national emergency and post the kind of a spread of the virus. I want to say and we'll see a little bit later that this is not just a decline it's a decline of absolutely historic proportions. At one point the evidence suggested that employment in the United States have declined as much as 20% or more. What you also see however is the beginnings of a recovery. There are a couple of things to note about this though that we're going to talk about a little bit more, which is that the recovery. While it's happening has in some sense, petered out a little bit and that's consistent with some of the data we saw even today. We saw were some additions to total jobs, but that that was happening at an increasingly slow rate. And so where are we now relative to where we were at the start, we see up here were about 6 or 7% lower employment. Does that sound like a lot. It is when you think that the total, the total labor force in the United States is about 150 million people. That's many millions of people who are not employed now, who might have been otherwise. So that's the first picture I wanted to show you. The next one is the same picture with a somewhat longer view. And it's a reminder that in fact it's not enough to recover to where we were in in January of this year because if you as you take a look at this picture the blue part of this picture is precisely where the previous picture starts. And one of the things you see is that in in a dynamic economy like the United States, the American economy with employment growing steadily over time because the labor force of populations growing steadily over time, we would expect employment to grow pretty steadily. And that's indeed what we see so when we say that we haven't recovered relative to where we were in January 20 in January. So everyone can hear me. So we left off at this picture. By the way, that was that was not me hitting a random button that was the internet. That happens from time to time so I hope. I hope we're okay. All right, so taking a look at where we were last time you see that we're sort of behind where we were in terms of thinking about long run growth and that's a problem. And it's a problem because as you take a look at this. We see that employment growth has been increasing we saw that in this morning's announcement, but it's been increasing at a decreasing rate that is to say, we're recovering but the rate of which we're recovering seems to be slowing down and that's disconcerting. That's disconcerting because for one thing it doesn't it's not obvious when in some ways we're going to make up all of this lost ground but more important. It's just that there are a lot of us still in distress. We see that in terms of unemployment numbers and we see that in terms of the situation of very specific groups. And so, one of the other things that this picture points out though someone reminded me this morning is, this is a picture that gives the lie to a story that went around a lot even in Vermont which was that we needed to be careful about things like $600 unemployment insurance benefits or premium, because those were considered a disincentive to work. One of the really interesting things about this picture is that it shows that we were adding new jobs adding new employment at precisely the time when that $600 was in place. And then when it disappeared to rate it slowed down. I'm not saying those cause an effect there, but if you're going to make an argument that in fact there are huge disincentive effects built into the previous pandemic unemployment insurance plan. The data isn't really hugely supportive. This is the picture I really wanted to start with though today and really bring your attention to and you could you could look at this on the opportunity insights website very quickly. So the blue line is the line we just saw this is total employment in the United States overall the red line is total employment for high wage workers in the United States. I'm not going to say highly skilled and I'm not going to say highly educated because those are all quite the same thing but I'll call them high wage workers. The green line is the same figure but for low wage workers. And what's disturbing about this picture is, while it is certainly true that from a from a health perspective and from an economic perspective, we're all in this together. There's a sense in which those burdens are just not anything like equally shared. If you look at the experience of high wage workers. It's not a huge exaggeration to say that for high wage workers, the recession is basically over for low wage workers, low wage work employment is still 20% below where it was some time ago. In a sense, the recession has been catastrophic for low wage workers, and you might think well that that's always the case but in fact I'm going to show you that this is much more extremely the case than than than it has been in previous years. What we really have now is what some people I know many people have heard about V shape and uship and all shape recoveries. Some people are not talking about a case shape recovery. Where well to do workers have basically on the road to recovery and and and low wage workers are simply still in desperate in desperate straits. I just wanted to show you that this looks exactly the same in in Vermont so this is exactly the same data as we just looked at but in Vermont in Vermont you see the same I mean it's still the case in Vermont that high wage workers are not quite as well off as they were in low wage workers are desperately much less well off right employment is still a 25 or 30 almost 26% lower than it was at the in January, January 2020 so that case case shape recession we were talking about is really pronounced in the state of Vermont. And even those employment numbers are a little bit misleading so this is a number you don't often see reported but I thought I'd share with you. So a lot of people in the United States, especially at the lower end of the income distribution hold up what is now called a portfolio of jobs. Once upon a time, many full many many heads of household in the United States held full time single jobs. That's less and less the case, what we now often see are lots of folks cobbling together multiple jobs. There's nothing intrinsically wrong with that except that from a point of view of thinking about measuring and thinking about economic performance. When somebody loses one of the two jobs that they use in order to support a family they're still counted as employed. And when that person comes back to work to that to a second job for example that doesn't get recorded either in the usual sense. And what I'm showing you here from the Federal Reserve is a look at the number of Americans who are portfolio job holders who hold multiple jobs. And one of the things you see is that that's not recovered yet, right, that one of the things that happened in the, in the onset of the, on the onset of the COVID epidemic was a collapse, not just an employment, but in the number of jobs that people who hold multiple jobs. And that hasn't recovered. So one of the things we're looking at when we look at that case shape recovery is we're looking at a lot of folks who not only lost jobs, but a lot of poor folk who basically lost a second or third job. And that is consequences for the way you think about policy to. There's just this kind of evidence I was suggesting before that in some ways you look at four previous recessions and the one thing that's true previous recessions is yes, low wage workers tend to do a little bit less well often every recession, but this one is different. This one is absolutely different. This is the sense in which, as I said before, we're not all in this together. And frankly, brutalized by by by the epidemic, which is why then some of the federal budget policies are so important to the kind of current conversation. Let me show you one other. One of the places you see this is the fall is is in the data on COVID in race. So let's think about this a little bit. Low wage workers have been especially hardly hit during the current recession. That means it means that low wage workers, the low wage workers who keep their jobs are often working in so called essential sectors. The low wage workers who lose their jobs often return to to residences and to cities and to neighborhoods that are densely populated. They often find themselves with reduced access to medical care. And so not surprisingly, one of the consequences of the economic effect here is for there to be a differential health effect. What you're looking at here are early days death rates for different populations in New York City. And the top diagram is the is the unadjusted by age. So notice, you know, you would expect, for example, that because one population may be on average older than the other that COVID death rates would be higher and that's roughly right here. So what you want to see when you look at this picture is that the white population is somewhat older is the oldest of the four groups in New York. And so it's COVID death rate actually is was surprisingly low. Given its age distribution, whereas the death rates of blacks and African Americans was on average, three times higher than it was for white workers in New York City. That's one of the consequences of that case shape recession I was talking about a second ago. A recession that hits poor workers disproportionately hard is a recession that almost by definition hits black workers and Hispanic workers. And so we want to think a little bit about that. You know, I think in the interest of time I'm going to this is kind of unemployment insurance claims. There's not a lot here that's going to surprise anyone. Maybe I'm just going to skip over this a little bit. Let's talk about this though. So what I'm looking at here is not employment, but using the same opportunity insights website this percentage change in consumer spending. So if you're thinking about, you know, economic health you really want to spend time thinking about consumer spending right consumer spending is 70 or 75% of total spending. It's going to be essential to any recovery and it's going to be a probably a driver of the economy for the next year or two. And so you see a couple of things here pretty dramatically one of the things you see here is that consumption spending is still lower than it was pre covered. It's about four or 5% lower than it was. You also see a couple of other things though you see very dramatically the effect of the stimulus payments. There's a lot of talk about whether or not the stimulus was effective or not. If you look at the dotted line right about here right, sort of April 18 or so. You see a sharp spike in consumption, but in fact the largest growth in consumption spending since then that wasn't when anything was passed it wasn't when anything was announced it was in fact when the first checks went out. There's a very real sense in which a federal government policy fiscal policy has been completely successful in propping up consumption spending at a time when employment was collapsing. And that's really important to know. On the other hand consumption spending has not recovered and I'm going to show you something that I think is going to surprise you a little bit. I'm going to show you consumption spending by the same groups we were looking at when we were looking at employment. And here's what's interesting. Here's what's surprising. The green line you're looking at is consumption spending by the same low income workers who were more likely to lose their jobs and one of the things you see is that until now at least policy has been relatively good about propping up the consumption or household spending of relatively low income workers. What's really interesting about the current recession and again it's a little bit unusual is that the collapse in consumption spending has all been by high income workers. So, in effect, what we have is the following we have a recession in which relatively high income workers are hanging on to their jobs, but they're not spending as much as they used to their, but they're not spending as much as they used to on the high income workers. A lot of things our previous picture suggests that were typically provided by low income workers. So it may or may not come as a huge shock to you, but all of the kinds of in person services that were typically provided by low income workers to high income workers in the United States, that market has disappeared. But interestingly, the collapse in demand for goods and services in the United States is not coming from low income workers. The high income workers who typically have not experienced a collapse in their income are often working from home, but they're simply not spending. And that raises a really interesting policy question and you can see this by the way in this in the behavior of the three groups, immediately after the stimulus payments right low income workers were clearly in some sense saved by the stimulus payments, there could be a huge spike in consumption spending, whereas the red line, it bumps up but not nearly by as much. One of the really curious things about this is the strange patterns it produces in spatial patterns geographic patterns in consumption behavior and income behavior in the United States so for example, it's the case generally that a no group of poor workers in the United States has fared worse than those workers who lived who live adjacent to relatively affluent neighborhoods.  And so we see this interesting collapse in spending and it's a collapse in spending that's largely driven by high income workers, that's going to be really important to understanding why some kinds of policies don't work. Right, and by the opening up for example policies may not may not be super successful. I want you to keep that in mind as we keep going. This is just in some sense to kind of capture the intuition so this is consumer spending on different kinds of goods and yes as we just as we just suggested spending on restaurants and hotels spending on entertainment spending on food spending all sorts of other things has basically collapsed other sorts of spending have basically picked up. I thought I'd share these to you to because there's another way in which this recession has not been the burdens of this recession and not been equally shared. So we said before that total spending is done is still down about five or 6% relative to to what it was pre covered, but the collapse in small business revenue is much larger than that. Small business is born a disproportionate share of the burdens here. And to the extent that things like payroll protection acts were not very successful at reaching out to small business that policy has to be considered something This is Vermont. In fact, Vermont, the collapse of small business revenue has been even larger, almost 30% relative to pre COVID peak. You might ask how interesting question might be is this because every small business out there simply as fewer customers or is it because effectively what we're seeing is a shuddering of lots of small businesses where the remaining small business basically pick up whatever, whatever demand is left over. In the language of economics, that's the difference between an extensive and intensive margin and the next picture I'm going to show you is the number of small businesses, which gets at the question of why we're seeing the collapse in revenue. And this is what you see the number of small businesses open has created by almost a quarter. So we see a collapse in small business revenue that's collapsing small business revenue is largely driven by the shuddering of small businesses, not by some kind of equal sharing across the board. And that's another sense in which the economics of coven are have to have to talk about unequal distribution of burden or unequal distribution of pain here. I'm only going to show you this picture because I've been you know I've been in a terrible economist right I've been nothing with grim today. And this is, this is a picture about how people are spending their time post COVID. The green line is time spent in the workplace and not surprising that's down. The red line isn't labeled I'm not sure why but I'll tell you what it is and actually think about guessing what it is. It turns out that one of the really interesting, happy byproducts of all of this is a kind of renewed appreciation for the, for the natural environment. People have. Well, Vermont is probably didn't need to fall in love once again with, with, with nature, but lots of people have. And that actually tracks in another study I'm doing in terms of attitudes about the environment. Often in a recession, lots of other kind of causes pro social causes are crowded out and that turns out to be not true for the environment and during the kind of epidemic. And that may be one consequence of this. All right, so when we talk about policy right so what can we do for for policy I'm going to show you two states here and I don't want to spend too much time on this because I want to make a couple of other more nuanced points but there's a lot of talk about how opening or earlier late is going to benefit economic growth and save the economy and save those jobs that we're talking about. So here I'm showing you a picture for two states. So this is Minnesota in Wisconsin, who as you can see before either of them closed had very very similar changes in consumer spending shouldn't be surprised. This is part of a broader Midwest economy, same larger macroeconomic forces that play same sources of kind of economic expansion or growth, same vulnerability to kind of swings of agricultural markets. And you see just before both of them close that in, you know, demand starts to collapse and that's exactly the picture that we saw before. Both of them have collapsed that that that consumer spending now is much lower than it was although the decreases sort of becoming smaller over time but here's that what I want you to notice. The timing of the opening was largely irrelevant to the subsequent path of the economy. And if you take a look at this picture, Minnesota opens well before Wisconsin. But if you were to look at the the the behavior over time of consumption spending in Minnesota Wisconsin, they look almost identical. In fact, it's in some ways you could argue that if there was any effect, the effect was health. The keeping it closed longer probably saved lives, but there were no economic consequences.  Remember that most of the collapse and consumer spending is driven by relatively affluent households, relatively affluent households were not going to start spending again on the sorts of things they were spending before, simply because that state opens up. I mean just to think about this in kind of completely personal terms right. It doesn't matter whether or not burning the airport is open at this point. There's no universe in which I'm getting on a plane. And it doesn't matter whether the destination state is particularly open at this point, this new universe in which I'm getting on a plane. And so to the extent that the pandemic remains in place. Most economists think it's impossible that we're going to see a fully economic recovery. So this notion of a trade off and I'm going to come back to over and over again. It's a really important lesson. And if we have one big lesson today of a trade off between okay, you know, can we have a little bit more economic growth at the expense of a few more deaths or vice versa is I think a false trade off. At the very least, it's not anywhere in the data. So I'm going to show you another couple of versions of pictures like this, but this is a really important picture to keep in the back of back of your mind and this comes from from Raj Chetty's work at Opportunity Insights. You see the same thing here so if you think the Minnesota and Wisconsin are exceptions. This is a very good this is a picture that does it for every state synchronizes days of open opening and closing, and the behavior of early closing states looks the same from it from an economic standpoint. Delay enclosure or not delay enclosure made little difference from a health standpoint it made an enormous difference. But from an economic standpoint it didn't make a lot of difference. So this is a complicated picture taking a minute or two to explain it but I love this pictures this doesn't come from opportunities as this comes from a really wonderful paper by an economic historian that's kind of a profession you may not have heard of Emile Werner at MIT. So I mean as one of those people who was fascinated by the possible connections between covert and the Spanish flu of 1918. And like all good economic historians he's collecting this unbelievably unusual new data and what he has his data on a lot of American cities between 1914 and 1919. Okay, and so on this picture what you're looking at is on the horizontally as you move from left to right, you're looking at mortality during the Spanish flu, the Spanish epidemic in 1918. Up and down on the vertical axis you're looking at employment from before the pen from from before the Spanish flu epidemic to after. So notice. If you thought there was a trade off, you wouldn't expect to see this kind of a relations because what do we see, we see generally that these two things move in the opposite direction when one goes up the other goes down. We translate that into into kind of economics language. Other things being equal higher mortality is associated with lower employment growth. So at some level that's not hugely surprising except when I tell you that the difference between the green states, so the green cities and the red cities in that diagram is precisely the difference today between states with mass ordinances. The green cities in the picture are cities that had a strong non what are called non pharmaceutical interventions, NPIs. And what I want you to know and the red states were not so think about the green cities as cities that had you know aggressive mass coordinates aggressive social distancing ordinances, which they did and the red as the red cities this not notice you see two things here first of all you see the green ones are all to the left of the reds, which tells you what it tells you that not surprisingly those ordinances work they reduce mortality. It also tells you by and large that those green cities experience faster growth after the fact. The green cities to the left. They're also typically above that line which tells you that they experienced more employment growth than you would normally expect it in that relationship. So the Spanish flu is telling us anything. And I'm as ambivalent about those comparisons as anyone, but if the Spanish flu is telling us anything. That those sorts of non pharmaceutical interventions in pre vaccine interventions may in fact contribute to longer economic growth not deterrents. That's a really important lesson. We see the same thing through internationally so so what you're looking at here this comes from our world and data this is a lovely picture for our world and data. So again, you know, all of this requires just a kind of a little bit of thinking about okay what's being pictured. So again from left to right here I'm seeing GDP growth relative to the previous year some so from second quarter 2019 to second quarter 2020. So the further right we are the better off the economies, the economy the country is doing right now knows all the numbers are negative is everyone contracted but still the further to the right you are the closer you are to basically having had no effect. As before the up and down we're looking at a confirmed deaths per million. And notice, I often do this with students and I maybe should have done this with you before I showed you the picture. If you believe that there was a trade off a trade off between getting the economy started and accepting a little bit of COVID deaths. What would you have expected to see.  I think I can convince you that what you would have expected to see is a kind of the points all crowded in the Northeast and stuff. What is to say, a kind of rising line here right that would be better growth but more death. But what you see when you see this picture is exactly the opposite. And really what we see is that countries that typically have experienced more successful economic growth during this difficult year are the ones that had lower deaths per million. And you see where the US US is, I mean, the US is really even well it has experienced more deaths relative to other kinds of experience similar growth, but it doesn't change away from the kind of core story that we're looking at here. I'll show you one version of this partly because I spent a lot of time in Finland, so this is the same picture looking at Europe, and some people are saying well apart from Sweden and talking about the odd Swedish case. What's going on here there's something Scandinavian going on here right Finland Norway and Denmark are all countries that have experienced both relatively low death rates, but also relatively mild economic interactions. I know a little bit about what policies in those countries look like it during that question and answer period. I mean it's something I know a little bit about too. So, if we're going to, if we're going to support us ourselves with policies one of the questions I often hear people talk about is, yeah, but you know that we've run huge deficits. We have a central bank that's intervening like crazy, aren't you going to have to pay some terrible price for this down the road. Now we're going to pay a terrible price down the road folks will say well take a look at a picture like this. So this, this says, this picture shows you over time, what the share of debt, public debt national debt to GDP to income is so right now for the US national debt is about 100% of total income is equal to total income. And you think okay that's a lot, but I noted I'd urge you to look at a couple of things that at this picture before you jump to any two very dramatic conclusions. First of all, we haven't added to it nearly as much as people might think. And secondly, I'm going to share the next picture. It's still not as high as this has been historically. It's expected to be about 108% of GDP in 2021 and say next year once we've absorbed the worst of this. That's about where it wasn't in the Second World War. And I say that precisely because the period of time after the Second World War is precisely regarded as the golden age of economic growth. And they think that debt burdens are going to just crush us all and make it impossible to grow. But if you think that this is one of the nice things about interacting with data, you would have to explain how it was that for a very long period of time for roughly 40 years after the Second World War, we grew fairly steadily, much faster than we're growing these days, despite so called debt overhang. There may be a story there, but the story that somehow we have debt that we've never experienced before, and that's going to crush us as an economy, just it doesn't make historical sense. I'll show you one or two other pictures in the middle. So the other version of this you see as well. How are we selling all this debt? And some part of it is, and this is often the part that seems to alarm big chunks of the public and others, is that our own central bank is buying it, effectively, indirectly. And why is that a problem? Well, how do central banks pay for this? Well, effectively, they print money, right? That's the one thing that central banks can do. So some people have wondered whether or not the central bank, the Federal Reserve in this country, is effectively monetizing, creating a huge increase in money that's going to come back and haunt us all someday when they buy up all of this debt.  This is the total. So from the Federal Reserve standpoint, an asset is something that they bought. So when they buy government bonds, for example, or they engage in quantitative easing, it shows up here. And you see even more than the financial crisis of 2008, the Federal Reserve has very aggressively participated in financial markets and asset markets, and it's holding a lot of government debt on its books. And it's effectively paid for that by printing money. And if there's, you know, one of the interesting things about doing a lot of these kinds of lectures is if there's a single kind of hardcore economic truth that people think they know, it's that printing a lot of money causes inflation. So that's why the next picture I'm going to show you is a little kooky. And I'm sorry, it's the least clear picture and it was the only one that had both of them. But the blue line here is inflation. Inflation is at an absolute historic low relative for so about rounds of the many decades anyway, despite printing all of that money, despite putting all that money out there, despite monetizing huge parts of the government's debt. We haven't seen an increase in prices. In fact, the central bank has gone out of its way to say we would like inflation to be higher. We're willing to tolerate more inflation in an effort to kind of bring the economy out of the current recession. If more money causes higher prices, more inflation. The record of the last 10 or 15 years is that it's almost impossible to explain. Inflation is for sure real issue, but we need a better story, but it both as a public and sometimes an economics. Another red line there is sometimes called a real interest rate. So when I borrow money, when you borrow money for a mortgage, you say, okay, I borrow money at three or four percent. Well, in a world in which prices are going up five or six percent and everything's going up five or six, including your wages. In some sense, you're paying back less in real terms than you're borrowing. So we call that a real interest rate. So why does that matter? It matters because right now the federal government is able to borrow at negative real interest rates. Yes, the federal government is taking on a lot of debt. In some sense to keep the economy propped up and to deal with this case shape recession. But it's able to borrow at negative rates. It's able to borrow in a way that actually requires it to pay back less in real terms than it borrowed. If one was going to take on a lot of debt, this was absolutely the time to do so. In real interest rates are negative now. They're expected to remain negative for a period of time. And so from a prudential standpoint, this is a good time to borrow.  So this is consumer confidence. And I'm showing you this picture because it looks like at some level consumer confidence has created. And at some level, yes, it has relative to its 19 or early 1920 peak. And that's really quite concerning. And yet consumer confidence remains higher now than it did in 2012. Then it did throughout the entire financial crash of 2007, 2008 and 2009. And so I see this picture as a kind of a reason for some optimism. I see consumers looking even in the midst of the current recession, the deepest recession since the Great Depression, and retaining some measure of confidence that things are actually going to get better. I think they're right, actually. I think they're right. I'm more optimistic than some about what we're going to look like in a year or two. And some part of that is honestly, you know, the experience of having lived by and large in Vermont and Finland. It's very hard not to be proud to be a Vermonter in the current economic climate precisely because we're dealing with this in the most grown up possible way. That is to say we're fighting the pandemic first. We're going to do as well as we can recognizing that we're setting the foundation for kind of economic growth to occur later on. And I think it's true of my experience, frankly, in Finland, where the population has accepted all sorts of measures in order to kind of track and trace more effectively in order to isolate more effectively. And it's willing to do that precisely because they understand that this kind of trade off between, you know, death versus economic growth is a false trade off. I think I'm going to end there. Whether we got this from a picture that comes from VPR. So I'm happy to turn to the Q&A unless somebody would prefer that I not. Beth or Carol can ask me not to if they don't want to. Let's see. All right. I'm going to go. I'll go backwards just because I have no reason to go backwards. So one person asked what could or should be done now financially to assist those who have suffered most in this pandemic and what should be done to prevent this trend in future crisis. So that's a great question. The good news is we've done until now pretty well. Before consumption spending by the lowest income households in the United States actually recovered, but that was largely because we were making very large transfers to those households. What's just and and I'll add another couple of things. Actually, I had one thing that doesn't often get talked about in a kind of macro setting, which is, we were pretty good at at at preventing eviction for a period of time. One of you who've read Matthew Desmond's absolutely remarkable book. In fact, it will know that eviction policy in general is a kind of it can be a source of poverty and in the United States. And there are two things to be really concerned about right now. We're seeing what we think is the beginning of a second wave. There is no emergency pandemic draw the emergency or additional unemployment insurance funds that we were making available to folks have also disappeared. And the CDC's moratorium effective moratorium on eviction seems likely to be challenged. So I would say this I would say, what we could or should do now is a version of what we've been doing so far. The $2.2 trillion bill that just passed the house goes some distance to doing that. But I will also say that absent that support the economy in terrible danger. So that's, let me so that's one question I saw next one is early in the lecture you compared high earners versus low. And you were talking about how having multiple jobs had an effect on spending. Do you have average numbers of jobs for each of these groups. Great question. And the answer is off the top of my head I cannot tell you the precise numbers, but I will tell you the following which is that multiple job holding is much more common among low income households and high income households. And some part of that is the kind of the increase in what some people refer to as kind of precarious labor right there are a lot increasingly low and middle low income households are calling livelihoods together by holding two and three jobs. And that's always been a challenge for it's one of the ways in which interpreting data has become harder right so now. Here's what's interesting when a recession hits. In the old days when a recession hit and you lost your job you showed up as being unemployed. Now when a recession hits, and you lose one of your two jobs, you no longer considered unemployed. And in fact we don't have a measure that says okay you're sort of a math employee. And so one of the things that I want people to be mindful of us they hear the unemployment data reported today is that it's probably it's understanding the extent to which people are still without their quote unquote desired number of jobs. I'll say one other thing about today's unemployment rate data because people have asked me about that on several other forum, which is unemployment rate data is also sensitive to who's being counted. Who's being counted as being in or not in the labor force so let me give you an example. Today, the data suggests that the total number of women in the labor force went down number of women working with was actually down. Despite that, the unemployment rate for women was also counted as going down and so how can that be. And the answer is a substantial number of women who were previously counted as unemployed but searching and therefore in the labor force are now being counted as being outside the labor force no longer actively looking. And so, even though the total number of women actually working was down it increased as a fraction of the total number of women who are considered in the labor force. And so that's one of the ways in which you want to be a little bit mindful of thinking about this data. So, the next question on many of my economic grass. Well not mine I want to say that for the record, small business activity and spending of different economic classes. There appears to be a blip upward around late May to mid June. This is the reopening in the majority of states and the answer is no it's not the reopening the majority of states. It's typically either payments going out or something else. The reopening. It's really hard. And I know this is a, this is a very controversial and some is very provocative claim. I'm surprised that even among conservative economists. I know that there hasn't been more evidence that the reopening plans did but in some ways their proponents or advocates said they did. And I would also suggest that, you know, reopening plans have largely been stymied by the fact bluntly that high income households were not spending on the kinds of business service they were before opening a or no reopening. And to the extent that low income households that were dependent on that spending for jobs. That's not coming back. And this is consistent with this kind of bigger claim that I one of the big lessons I really want folks to leave with today is that there is no cure there's no economic recovery here without a solution to the pandemic without it without dealing with the health crisis first. Next question. I wonder if the reduction in spending by those working from home is due to a reduction in keeping up with the Jones's factor. Working together in an office when it hears from others what new things they have bought and you think that you may need that also that could be. Yeah, for sure. I mean one of the really interesting things to me as an economist just think a little bit about how the culture of work is going to change.  What is the influence of other workers. And perhaps less important now than things like spending on travel and food and entertainment and all of that other kind of stuff. In fact, there's some evidence that spending on some kinds of consumer durables have gone up so I had no idea whether this is true but an economist friend of mine in the Midwest told me that in parts of the Midwest spending on swimming pools is up. Has the ring of truth to it. And the story there would be right that that households are now spending more on quote unquote home activities. But yes, keeping up with the Jones is a real issue and I'll say that returning to the workplace is more than just kind of conspicuous consumption culture right I mean the workplace in workplace interaction is important for a lot of reasons cultural economic social, and I'm wondering exactly what we're talking about what we're going to see post COVID are we all going to come back and and in some sense return to a culture we had before and I don't know what the answer is my sense is no. So another question, but I like the Jones question. So what is the case shape recovery what does the case stand for so the kid doesn't stand for anything other than the fact that the, like all of the other descriptions of recoveries the idea is that the recovery resembles the shape of the letter and so by K effectively what we're talking about are now two paths right.  And the hack that's going up are typically high income workers right who's, whose jobs have remained and who's spending is down a little bit and low income workers who basically still seem to be struggling in fact there's this really evidence that they're under enormous pressure and that pressures related to for example eviction are getting worse not better. So, I hope that answered the question about eviction. All right, what information do you have about older workers leaving the workforce because of covert who replace these workers when the economy recovers. Great question. So, yes, some part of what we're seeing when we look at unemployment data is the consequence of workers who are effectively and in the language of economists they transition from in the labor force and employed to not in the labor force. And some part of that is indeed older workers who are counted as leading the labor force when I'm no longer counted as looking who replaced those workers. I don't know this is a very interesting question. There's a lot of talk these days about the so called labor force participation rates of especially older older men and they seem to have collapsed start to collapse even before the, even before the covert epidemic. And so we don't know I mean a standard economics reason would be if in fact work becomes you know if firms really find themselves searching for work and workers are scarce because of the retirement of older workers that wages will go up and people will then be drawn back into the labor force. That's a great question and it's something we're watching actually right now. All right, and I think I'm at the question at the top of the list, which is since the Trump administration changed the agency to which covert 19 statistics is required to report sometime in early August from the CDC to a private company. What is the current quality and accuracy of the coronavirus dashboard in the US great question. And I'm going to say that the problem so I'll say that the problem is not specific to the United States. The quality of reporting data varies a lot all over the world, and with lots of countries having obviously pretty strong incentives to suppress some kinds of reports. I will, I would urge you in that context if you're looking for the best possible data. We start the our world and data folks and one of the things that makes their exercise really remarkable is they're trying very hard to recognize when this kind of stuff happens and then to calibrate right so for example, if reporting, if reporting rules change that in principle if we observe enough examples on both sides of that kind of change, we're able in some sense to correct for it right and so this, this effort to make data commensurate across reporting regimes and across other agencies is a really difficult one it's a big challenge for economists. But I think we're making some progress in that direction I really urge you to look at the our world and data site. For what I think of us as absolutely the best data on on on COVID death rates COVID infection rates. New infection rates and so on. The one thing I'll say is that it doesn't typically disaggregate by the state level. I'm seeing have I done all of the q amp a I see if I'm allowed to I have Beth asking a question or two in the chat. So I'll take a look at both of those. And then I'll take any more questions people have them. So, so in the chat I have how long will it take for low wage earners to recover after the vaccine or will they recover to any great degree. And what will it take for small businesses to recover in the US and Vermont. Wow, that's a great question. You know, I think the hope obviously right is that the advent of our kind of a widely accepted and why what widely used and this is a big issue. Vaccine is going to bring the economy to some back to something like where it was before. I'm not so sure, however. You know, I think that at a minimum, I guess I would say this my concern at this point is more about making sure that low wage workers make it through the next couple of months. And that's because there's frankly not nearly enough pressure on Congress to pass something that would rescue these workers, which still astonishes me right I mean once upon a time. The months before an election was typically a period of time in which, you know, Congress went out of its way, right to be generous to workers of all kinds. The notion that low wage workers have been abandoned still kind of puzzles me at some level. So I my concern at this point is less about what they're going to look like when a vaccine happens and just getting them to the point where the vaccine actually manages. If the spending of high income households recovers my sense is that those jobs will come back. I think we're going to have a different conversation after that however about things like healthcare and other things. One more question from the chat and then one more from the Q&A. The UK's economy is declined the most what lies for what lies for them with Brexit on the horizon and likely a no deal Brexit, which countries likely to come out of the pandemic the strongest economically. The UK has suffered a great deal and Brexit is not going to make things worse but not not going to make things any better. You know you look at the economies that have done relatively well and they at this point they tend to look like the Nordic economies. Some part of the Brexit problem and honestly some part of the problem today with the news that President Trump was infected is that economies don't do well under clouds of uncertainty. It's one thing to say good or bad. It's another thing to say hugely uncertain. And in that environment Brexit is as much a problem because of the uncertainty it introduces as anything else. So yeah I have a daughter who's kind of living through. I have one daughter in the UK right now and one daughter in Sweden. And so between the three of us or my wife the four of us we are literally experimenting with four completely different approaches to pandemic and the economy. But all right. I'm seeing one more in the Q&A. Is that right? Oh two more in the Q&A. Well I love a couple of these. I hope I have enough to answer one of these. All right so I'm Canadian living in the US and want to know if the US stats parallel the Canadian. So Canada looks a little better. But looks more like the US than does other European countries. For many of the same reasons right this kind of the notion of a trade off some resistance to the imposition of any kind of public health requirements or restrictions. I'll give you an example actually so in Finland right which I showed you has relatively good economic performance of low numbers of death. You know the kind of sort of high tech, vibrant high tech sector. One of those high tech companies came up with a kind of the equivalent of a kind of self-enforcing kind of tracing contact tracing mechanism. Let's just say everyone would kind of get down on this app everyone would kind of enter their status and the company would do whatever it needed to do to assure privacy. And what it would let you know is whether or not you were in the proximity of anyone with a positive diagnosis. And what's charming is that you can imagine basically that although they exist no one is proposed using the United States. The day that it was introduced in Finland, a third of the population signed up. So what are the countries that are going to do well? The countries that are going to do well are the countries that limit the health consequences of this. I mean it's that simple. I'll answer one. I think I have time for one more. I have to answer this one where has nothing to do with the talk but somebody asked it. And I'd love to answer this feature. So the question is why is economics called the dismal science? And I love this question because you know after talks like this people say you're really pretty depressing fellow. But actually I'm proud of that name. So I'm proud of that name because it was given to economics by Thomas Carlisle who was a very conservative historian, British historian of the early 19th century. And the reason he gave it to economics was, I'm not a big believer in Adam Smith, but Adam Smith would tell these stories right about the benefits of competition. One of the things he would say is that competition was able to erase prejudices. Every single person can some way stand on their own. And the notion that somehow we were all equal in some way really offended Carlisle. Carlisle thought we were a dismal science because we harbored these crazy illusions of equality. And that we weren't willing to recognize the kind of the realities of the world out there.  And I'm seeing at least one other person cut on so I'm going to stop there. Is that okay for everyone? Peter, thank you so much. We do not consider you dismal, I'm sorry. That was a fascinating discussion. Really, really worthwhile. Perfect time. Thank you again. Thank you very much.


Hello and welcome to day 11 of advert of code in Haskell It's been a while I've been doing it now for 11 days like we're almost halfway through right? It's starting to get harder That's okay We have the power A pluribus unum no We're mostly doing it ourselves. Anyway, let's start with day 11. Oh my god monkeys Happy third advent. Well little Annie back at it With the tank Finally start making your way over realize your pack is much lighter than you remember Just then one of your items from your pack goes flying over that monkeys are playing keep away Put a monkey emoji and chat. It's too hard to find. Let me see monkey in the middle. Okay. Oh, wow It's a two which two or more players must pass the ball to one another by player in the middle attempts to intercept it It feels like you know exactly as a form of bullying.  Wow. Anyway So we take some notes on the items these monkey currently has how worried about your life Well, I won't give my sensation basically where the blood first Just Good thing this is all remote. Anyway, okay seven monkeys Okay, that's it so proceed, thank you Okay, so they work on how worried we're about each other. Anyway, this is a bit much but I have to say Okay, then let's just put this into example and If I like some example Okay, three monkeys and we keep the example here now, let's parse a monkeys data monkey Equals and okay, it has starting Items is a list of emails. Oh operation is new equals old Times 19. Okay, then we let's just do that a Operation so sometimes it takes in It just takes in one Operation, let me get the input. I'm not worried about how are we gonna parse functions Let's get the actual input So it's all divisible by that's in the operation and then it's all new It would be probably be a lot faster A test, okay?  It's all a test There's some condition Okay, so divisible by monkey to monkey. Okay Repeat to preq. I think it's read preq to P right to preq to Yeah, so where's the reach preq? Yeah, so it's read preq to S this Or is there a combinators? And then this is rp.live And then this is gonna be read preq. So how do we parse a monkey? Well first do first we read the screen then we skip space parse and int So we reads let's see how do we read it? We done this before right a read as Okay, it's case-paid read as to P Let's see how it goes because we don't Enable type application What is the problem here? gco, day 11, day 11 of HS and day 11 Why is it complaining about now? Okay, why doesn't it want to do string? Okay, and then skip spaces, right? Let's just do fine and monkey and then we do ratio now, let's just do this one Let's actually do lines We have my lines over it Let's do the chunks function from day two We do a lot of these chugging things because we're just gonna take the lines and then give it a couple of lines Chugs and then one monkey takes one two three four five seven lines Compilate it compiles now. Let's do read input Instance show Show is equal to Relative no parts. Okay. Let's say first a trace show here. I didn't save the file monkey zero. Okay, then Yes, good do monkey skip zero. Okay, and then I'm gonna get the monkey number and then we're gonna do chart Skip and then we're gonna say starting Okay, we're gonna say string starting Now we're gonna say Set by one. This is set by the chart comma so Let's call this here Now we're gonna print out the number and starting Okay, you got the starting on it. Oh, you're gonna skip spaces boom Okay operation new equals. Okay, so let's say here String Operation called a new equals skip spaces Okay, now we have to do this a person expression Okay, and then what are they probably the okay operators we use it's either times all times old or Okay, let's do it. And then we're gonna say parts expert and up is parts expert where expert equal to do so is it gonna say first a string old Okay, and then Up is gonna be a choice So we have two operations, it's either gonna be a Char star and we're gonna return multiplication or it's gonna be Char plus and we return Okay, and now we skip spaces again Now so cars of our Okay, so string start with all the skip spaces. Okay. Now we have a choice choice Raise equals a Choice it so either we get a string old and then we we return turn a function that says a Well, we always take in take it in old and returns a Up old old Okay, otherwise string Otherwise, it's a read so it's gonna be do A int we read the end read Add in and we need to do read as to P read as to P reads int and we return a Function old up old I hear Choices It's just choice. Okay. Now parse expert Rates and returns the operation Okay, so we parse the expression and They let's see where we're at that. Okay, it didn't work So we two string old now. Let's say a Trace show and let's say look into So we're passing expression. Okay, we said old Skip spaces then we get that. Yeah, okay now We parse the expression we skip spaces Okay, so we get that. Okay. Cool. See I like how we didn't Check it out and be like We just party skip spaces. Okay. Next we have a string test the V divisible divisible by skip spaces and Test div test div is gonna be a Let's have a test here to be parsed test. Now we say Okay, I let's actually make this into a Not parsed action parsed up. Let's just Pursing it's part of the same. Okay, it's gonna be string operation new equals skip spaces and then we have This is just Make it a bit cleaner And meaner Okay, parse up. That's like this parts test equals a string test call them divisible by skip spaces and Then we read the number And we just return and the operation return is And Mod Number Equal to zero. Okay This is how we say divisible by So we parse skip the basis of parsed test 2% number. Okay. Okay. Okay. Let's say it has A test is gonna be what we recall it. We said to call it test. Okay, and then Parts Let's print what we have now True if true. Okay problem again would do.  Okay, so skip the spaces if true then we do a parse con We need to keep spaces yeah cars con true Okay, and then skip the spaces Huh, and I think we did it and then we're gonna just return and Right, and it's complaining that a number Operation, okay, this one is gonna be operation Operation what is not what is missing here? Okay test true test false Let's say test true The test is not into it is actually into Booyah. Okay, we got monkey one two and three. All right No, I just want to see if we can Let's see if we also parse the input. All right We managed to parse the monkeys Hey, hey, we're the monkeys Monkey go monkey around Yes, it's because we are Okay Read monkey unlines a Where is it in the current trace? Okay, we managed to pass the monkey. Let's say now. What are we doing with these monkeys? Just pure computer science. We don't really care about what we're doing Just want to set our Monkeys up. Okay Three monkeys Each monkey has several attributes starting items. This your worry level for each one monkey is currently holding in the order They will be expected operation shows are your worry level changes as that monkey inspects an item Okay, test show how the monkey uses your worry level and decide where to throw an item next After each monkey inspect an item, but before it tests your worry level Your relief that the monkeys inspecting damaged item causes you to worry level to be divided by three And round it down to the nearest integer The monkeys takes turns inspecting and throwing items on a single monkeys turning the specs at all the items And this only one retirement order is listed Okay, monkey zero goes first and monkey one and so on each monkey has had one turn The process of each monkeys taking a single turns called around a monkey starts around with a white It's the kind of expecting that when there's time its turn comes around if a monkey is holding no items at the start of its turn its turn ends Okay, uh any little any is in the Christmas mood Okay, a monkey bite going item where levels divided by three two five hundred and one uh-huh 500 so it's not so it's a float Current worry level is not advisable by 23 anyway, we're level 500 it's round to monkey three Okay, um We have multiple pockets and we're like throwing From the pockets Okay, now let's then Do this I feel like we should have like We should have some We should have some buckets here. Uh starting items Let's have this to be an int map because we're gonna be updating it a bunch. Uh, no, we have to repaint in the list Okay, then so, uh monkey and turn Take some monkey and so, um What does it do? um, I'm gonna expect things And I always throw two other monkeys, right? Okay, it takes a monkey to a monkey Int map, okay a Monkey turn now, let's see monkey turn Okay, so, uh, we have the Let's first Do all the worry levels Okay, it equals so and so where Items equals starting so items prime equals and map operation Over a starting items. Okay. So first we do all the worry level uh Uh, the worry levels So it first do it and then we divide by three and then we check Okay, let me see Anyway, so operation shows that it's an operation test show after it's monkey inspects nine But before it has your worry level you release that the monkey's expecting to damage it because he will survive by number three I think that's just diff, right Uh, so I think it's just like this. It's monkey and then flip div a flip div three So these are the items and then And then we're gonna do a So it's not spam. I don't think it's bad. It's a partition Partition I think from google. Let's see google partition Yes Okay Import did it on list partition And then we're gonna partition based on the so it's so Tt and t file so test true and test test t test f equals partition Test Okay, so we partition it based on the test After we divide it by three And um So let's actually Keep it like this. So this is gonna be int map So these are gonna be things in air Okay In air we take a monkey Uh, and we just we could just actually When we initialize it we'll just put the Uh starting items for that monkey Uh a so let's just say in air I am dot bang We have starting items, but we are actually using them too much. Okay, so, uh import qualified Int map data dot int map as I am Import data dot int map Map as I am No We just get the int map And then in air, uh, and then you say number Okay, and the this one so we partition the test And we say a So we so we modify the impact by so modify I am dot modify Adjust, okay, adjust the value to specify the key when the key is on the under map is returned um update I think it's just adjust because it's always gonna have the An empty list for the or the starting items so I am dot modify and we're gonna add test t Uh, no, sorry, it's adjust Adjust So this is got the operation and then we say this is the True test let's call this True test false test And now so we want to add the to the true test Yeah, plus plus test f false test And finally we want to say I am Dot adjust Set it to the empty list Hey For the current monkey right because they've just processed Int map of a list of things and let's go to this Um, yeah a number Testy test f oh partition Then test Then we just do the flip the map in error. I am number Okay, this is a monkey turn Now We don't care, but let's say one turn After around one monkey's holding eye with these worry levels. Okay.  Uh, so we take a monkey and we give it into a number comma starting items And we map that over the And so the initial map here is monkeys now Initial map and fold l and then Initial Initial map And the problem with the initial map is that it's not Okay, now this should be one turn. Okay, let's see read input example ask one print So 20 23 27 26 20 23 27 26 28 8 25 1 6 7 207 1 1 10 0 46 Okay, so around two after round three after round five Okay, let's say call this here. Let's just say here Turn is equal to um Takes an int map. So it takes a list of monkeys And takes an int map to int to int map to int turn is equal to uh fold l monkey turn Monkeys This is gonna be flip So this is one turn. Okay, uh, so if we say then uh iterate So let's call this Itcher so let's call it iterate And so let's say take one And then print iterate Turn and iterate needs an initial value, right? um Okay, so this is actually here's monkeys. So this is gonna be iterate a turn It's gonna be head of iterate A turn iterate turn keys And then Initial map. Yes. Okay, so let's see here task one Grand task one Is this turn two? Okay, let me see. This is a monkey And it's an int map is equal to fold l Then we're gonna say flip So this this one should be just turn turn turn monkeys Apply to initial map. Okay, so that and so the turn here is correct. Okay iterate turn monkeys initial map Print. Okay, I feel like this is the reverse ah This is the initial list Okay Make sense Okay, uh chasing all monkeys at once about we're gonna have to go Be able to control the monkeys monkey each time Each monkey inspects items over 20 rounds Okay, so then we just say a So Okay, so we say take 20 We might be out by one here Take 20. Okay, so rounds equals take 20 iterate monkeys initial Okay, and Now we are going to say map We're gonna map over the I am okay. I am So we're gonna say How do you map or an int map? Okay, it's a functor. Let's just plan say Per round equals I am f so it's gonna be f map length. So we're gonna say map f map length Round so let's just start with a two two rounds first and we're gonna say let's say this is going to be a int map int it's going to be a list of int maps int Per Okay, let's see what happens here. Now. Let's not take two. Well, okay. We can actually do that a Round okay, take 20. So we're just gonna look at the first two. Okay So this is this is how many a items monkey zero has four then two Monkey two has three items and monkey three has one item And then monkey three okay Now union now I'm gonna say something called union with oh Hey Let's just do that. Okay. So this is gonna be I am dot unions with Plus and this is gonna be Okay, now we're not gonna take two here. We're just gonna print task one Let's ask one 101 95 3 1 101 95 But because so they because they look at it They look at it like per round Okay, we're not quite there. We are there for monkey number zero But because we kind of because for monkey zero it starts in the beginning and then Okay, we need to do this again Um, so we can't do it just We need to figure it out. So we because we're counting how many times they check it So let's say we're adding the test here So it's gonna be monkey starting. So we're gonna just keep track of How many times people have expected in here and this one is gonna take an int map and it's not a list of It's a list of int comma In this is gonna be a Is it gonna be a c comma underscore a let me do c plus length D Where her items equals in Air number And we're gonna do second. Okay, and this is gonna be a oh wait Her items is gonna be first of this one and this is gonna be second Of this one Okay, and this is gonna be c plus I know so we actually need that. Okay. Yep. Sorry Her items and this is the the second and now we've looked how many we processed Let's say plus length curve items and then the new items that the monkey has is just you know, this Okay Is equal to L s right Is equal to a c comma l s plus plus l s prime Now let's go This could actually probably be a set but we don't need that add a Flip add test t flip add test f Do Okay, and what is the problem here, right this one actually should return Int comma and now we are and we're not gonna do this We are gonna say um Let's this is a list of In comma Let's say Okay, and this one takes an in comma now, let's take one round Take 20 words Okay, now this was gonna be the uh, we take the head of reverse head reverse round I am dot f map f map f s t So on the like the after 20 rounds, right? Okay, so we say so around We take the head this one, so we take f map first Okay Oh, we do not really need the other here in between this but it's all good in the hood Okay, the two most active monkeys. Okay, and then list of hints I am dot l m's Okay, this is the Level of monkey business. Oh, no This is the level of monkey business Okay, what is the level of monkey business for the input six four three two? Let's see Slow today. Oh, that's the right answer. All right Cask one done Hope all the work we put in a Okay, and now we're certainly not gonna keep the thing in memory, right? Let's see Uh, because we don't need we can just take and okay since he iterate Uh, no, I don't want to say And a to a to into two So a to into two So let's say What do we do? But what happens here? Okay, this is all int maps A you can still be an ink map, but these will be integers Integre Okay, then we don't say so reads and then starting items. This will be read at So this is actually I mean it doesn't matter for Let's go Could match type in the fact actually trigger into bull So right, okay Integre Now we can do all the monkeys on so I'm wondering if we can just Okay, get away. Can we get away with it? Probably not right? It's gonna be like one of those. It's super slow for doing it Then I away Monkey turn two Okay, and then we just don't divide by three Expect it. Uh, yeah, that's because this is integer. Does it still say it?  We're seeing if we can get away with being lazy And just run it for a thousand rounds I think it should work, but I'm not convinced What is the problem? What is the problem rounds? Okay rounds is a list of int map int comma list of integers Now here I don't actually need that I don't actually need it F map first F map first F map first, okay Uh, let's see. What was the day eight? Part two, I forgot. Rounds is an int map integer. So this is gonna be an int map of int Okay, yes Let's do reverse And then we take the Head oh, yeah That was a bit We did it by transpose Transpose transpose transpose. No, we did it like by kind of dynamically. No, it's not almost dynamic. I think I think we almost had We could have made it dynamic But we kind of we did it the boring way But we could have been like kind of lazily evaluated like oh this one is the sum of all the other ones We we ended up not doing it. Okay. So what is the rounds here? Okay, and then to reverse and then to head Okay, so this should be int map of int comma list of integer Okay, then F map fst It should be a list of int Okay, and then we do this We reverse this work and we do the product What is the problem here? Okay Oh, well, this is still we're editing task one. Yeah, but we wanted to be editing task one. It was a bit We had to yeah, I mean it was it was shenanigans, right? We had to We had to make it work Okay Okay, this is how it is now Ask to Where turn Turn is going to be monkey turn two. Yeah, so monkey turn two Same but okay. We do for 20 turns Okay, let's see Ask one. So let's use the So the component numbers don't get that big but the resulting number gets quite big Okay, so we sort them and then we don't know we're not going to product like this We're gonna say integral now from integral and We're gonna go from int to ticker a map do I convert these two to Let's time it. Let's bump up the task and we're doing it for the example So Bump it up to 2001 this might take a while Okay, let's say not to ten thousand and one And it's all through Let's open another terminal and just say h tab Okay, the VM is just stuck that is Sad Which means that we need to actually do a bunch of stuff Which my the vsl should not be doing this bad, right? It should at least Do not correct, but it did okay. Let's go back to Maybe we should run it for some smaller values first, huh? But you know, this is what have we been asking for right? We've been wanting to We've been wanting to do more performance heavy stuff, right? Let me just check one thing before We have rounds it may be intended to take ten thousand one Uh Oh, okay. So now we're just kind of keeping every track of everything Which is a lot of Work And it doesn't work. So Let's think about it a bit Better Okay, so like this one, right? So if all this is advisable by 23 um It's never gonna it doesn't have to yeah So I want to see if I can like compute right like what is the result Of one round, right? Like how do you just how do you just? Okay Now we're like throwing one of the monkeys And then we're adding them to the list Okay, let's see the the crashed for ten thousand one, which was okay Let's see what 101 does how how bad is it? Okay, we don't have any history either Let's say here, uh ghc. Uh, let's see cd day 11 ghc o day 11 Day 11 dot hs and Compile it Okay for 101 it's not too bad. So can we like Could we somehow memoize it? j 101 A thousand one Is it already super bad then? And like how is it slow is just taking up all the memory or Because I feel like you know, it shouldn't lock everything up, right? That is for sure. Okay. Wow. We just Just consumes all the memory. Okay that day That's why it just crashes that bad Yeah, okay, so it's not really slow. It's just crashing And it's probably because we do this iterate thing, right? So let's not do iterate Let's write a f apply and takes an int and an a to a and an a a and returns an a now apply and zero Doesn't matter initial value equals initial value apply a and if apply and Diane and minus one f f of a So this is going to build up a bunch of funks Okay, let's see what if this is any better So instead of doing reverse of round head or reverse around we will just do apply and thousand one and it's a turn monkeys Initial map, let's see if this is any better It should be right because we don't actually have to keep the list We might need to make it strict though. Let's see here. It just eats up memory So fast damn for 21. It's a it's not giving me the right one for what was supposed to give for 20 All right, that's because it's monkey turn two monkey turn Yeah, okay. So but it still is we were correct in that it should we should apply it Okay Um, we have the initial these are these are not the this doesn't matter So but let's try and make this strict import that from data list Let's say now we have one monkey turn two The fold l prime should not have as many things in memory Hey, let's see if we can do like It's also like a lazy map, right? Let's do Let's make the map strict Okay, so now the map has been made And then we don't have as much Okay, we can actually just change this to An ideal map Can I see what happens now? Okay. Hey, now the map is strict. Can it go up to a thousand? Still eats a lot of memory Ring ring ring ring ring. Let's try and make it apply and strict Uh strictness Ask for a bank pattern A b b d b d b b b Patterns here. I think it's then becomes Bang maybe it's already gc 2021 probably not no Let's not try this dude. Let's try to do this dollar bang So, okay, so it's really only this, you know old times old here which a affects Makes the numbers huge, right? Uh, but multiplying a number by itself will never affect its divisibility Okay, so what I'm gonna just do is I'm just gonna say star and then If it's a Old then just return old Because I think in the input also We're multiplying old plus two plus five and then here we square it So I think maybe that's Not full Okay, but it so now we can get the number The numbers are a lot smaller. Okay, let's see Okay, so that that's really the problem here is that This is the problem is that these numbers become super small super big a So we want to Somehow address that right so apply and and apply and So let's just see if it handles this Yeah, see We could do it If not for this old times old operation Beepity beep beep beep But how do we so how do we handle so eight times a mod b so there's some like he here, right? It's a bit funny, right because it should not affect its divisibility Because then there of course, we you know, we add numbers and stuff like that later It's a how do we how do we handle that specifically want to do So I feel that's also what's happening, right? Like it's doing fine until it hits these huge numbers and then it's Then it starts slowing down real fast, right? Anyone have any ideas feel like this is this is now it's hard, right? We saw that right? I think it's not really the data structures. We're using right. It's really the It's not like a Haskell part that's slow. It's just that the This testing and multiplication Is what's Slowing it down But even if I have if I have if I have monkey turn here It should still be not so slow If we keep dividing by three No, maybe not little any you've been watching so many of these Where you don't learning anything Okay, and Right. So monkey turn is so it's also bad for monkey turn If we always multiply them together and then um, maybe I need to make the uh This one straight Let's see. How does it look after? A hundred operations Could I like periodically like Like clean it up. These are some big nums So it would be really nice if I could like do this modulus something, right? Like, you know, can I multiply together all of the numbers? I should be able to do that. I think okay, so if I take all the The tests Let's make the test actually not like this. Let's just make the test be number Number okay, so we put it as a number And then the test is a is an integer okay, um Divisible by reads that integer and return number. Okay, well, then we just do return like this Okay, now instead of doing partition test we do a partition A to test is going to be so it's going to be and test a test mod No, it's going to be n mod test Equal zero Okay, a Now and we're going to see the same here test Zero equals dot mod test. Okay, it's going to be like this I don't I don't think it works. We cannot just do modulus a Because like the pluses are there as well, but let's see a The test mod test to monkeys. Okay Now, let's print. Let's forget this here. Okay, so All test equals product Our product map test monkeys That's so map test a monkeys monkey. It's called a test right here. And what is the problem like this? By and turn monkeys in patent integers. So all tests is an integer now What I am going to do is a Modulo It's going to be take it's going to take an int comma list of integers And it's going to return int comma list of integers Modulo a Do mod a Do do mod. Okay. Do mod I comma ends is equal to map mod tests a NS Let's turn this into an int map in comm weniger to a map A and this is just f map and now let's call this So and then we just into integer into Blabla blablabla blablabla Okay, a all tests. Now I'm gonna say f map do mod Those are very good so this is the idea right we just keep it within the modulus of all of them i feel like this is chinese remainder theory something like that but i don't know let's call let's see here 21 now let's apply this 20 times and let's call it for monkey turn and let's see what it does maybe it doesn't matter for monkey turn 10105 now i want to see for monkey turn 2 and what does it say for monkey turn 2 after around 20 gd day 11 gc o day 11 day 11 hs and day 11 so 10105 2 305 so 99 97 803 99 97 803 okay what does it say after a thousand and can we even do a thousand five two zero four four seven nine two five two zero four five four seven nine two one nine nine five one nine two oh no nine five one two okay okay let's uh let's keep going right um what about does it still work oh no okay let's just go to 10 000 five two one six six uh four two zero one three huh so it does work oh my god okay uh yes so what did we do we did something called chinese remainder theorem okay and so if you're taking the modulus of a bunch of numbers and you can this is isomorphic to a ring blah blah okay so what happens yeah so we're doing like something like case of two okay but the idea then is right so instead of we can because we're all only checking for divisibility and that's the only thing that matters actually actual numbers don't actually matter uh we can just take the modulus every time and keep them within the ring because you know if we add to it and we multiply it we're just kind of figuring out new steps in the ring but uh yes okay so i'm gonna do it for the input now but this is the number right for the example two seven one three three one oh one fifty eight now it's gonna it's gonna be slightly slower for the input because it's seven numbers but not too slow you see how we did that though we did um we used the math let's see boom i guess that math degree wasn't for nothing anyway this was a hard episode and but i might not have a bother to solve this as i didn't know this math trick and i mean i didn't i didn't i wouldn't say i knew it but i'm aware of things tricks like this so that's why you you can think of it let's just give it a go if it hadn't worked we would have been doing something else but uh yeah but the idea is that so divisibility is only affected by like uh so yeah so you so you just multiply all the checks the divisor checks that you're doing together um and then yeah because and then if you do modulus that like yeah if you go above that right you're still like the divisibility will still only depend on so the visibility will only depend on where you are in the range of those numbers right uh how to do this let me explain it a bit so here's three so three let's say three times five let me let me write something here uh okay so we're so we're gonna check if something is divisible by three and if it's divisible by five all right so let's write it out so we have zero one two three four five six seven eight nine ten eleven twelve thirteen eleven thirteen okay we don't actually okay so and the check so this one is divisible by three and five and three and five three and five and three and three and three i feel like there's a bigger gap okay three and five and three okay now let's look at 16 that so that that's kind of back to so this is gonna be we actually don't have 15 here uh so it's gonna be x y okay now 60 so yeah so the idea is right if you're just checking for divisibility between these two numbers that this pattern here will repeat it so so let's let's write it out again like 16 okay let's actually have some numbers here you should study math kids okay a three a five oh my god a six a okay and like this and then 12 was there and 15 so 16 17 18 19 20 21 22 3 24 25 26 27 28 29 30 31 okay so let's look at it so not divisible not divisible 18 is divisible by three right uh maybe i'm screwing up here x a y x a 23 24 24 is divisible by x and y okay sorry it's 15 then 16 17 18 19 21 22 23 24 25 26 27 yeah that's divisible by three 28 29 30 oh and then this is x y again sorry x y right okay and the problem is here that 15 should not really be in here okay so this one so zero is divisible by both okay this is why it doesn't look right so zero is divisible by both okay now 15 should be here and x y so divisible by both right and i think this is called the chinese remainder theorem right so look take a look see the pattern repeats itself uh and this is the idea right so the pattern will always be the same so you just multiply all of them and then you can just keep it within this range and it forms a ring right so this is all number theory okay people like ramanujan shout out to my main indian mathematician they're all about this right so and this is why cryptography works right anyway yeah and this will repeat itself again and again right i don't know i'm gonna explain it but so take a look at chinese remainder theorem so those are right yeah okay maybe it's not the chinese remainder theorem but it is yes uh oh no okay i think this is the opposite okay chinese remainder theorem is something else so you see pretty lovely i did a lot of verbatim copies in which my nose a bound on the size of the result by several similar so okay so it's actually rings or something anyway so this is the idea right and the trick is that these are all prime numbers yeah i should mention that this doesn't work if these are not prime numbers uh yeah that's important anyway the pattern repeats okay let me put this right here straight up the pattern repeats oh my god so we can do it be a modulo and remain within a ring and what is a principle ideal yeah this is like the passive part of math that uh so i failed the test this is like algebra one in math at the university so i had so i failed it because i wasn't paying attention in class and so i had to study it again next year to get the math to get the uh to do the test right so this is why i think i remember this clearly all right but anyway math state 12 and day 11 uh get at day 11.hs input example get status get commit um day 11 get push okay that's it for today um just remember this trick and do it in your language of choice but of course classical is a language of choice yeah i was worried that we're like oh no it's lazy that's going to fail no no it was just math anyway i'm gonna do this again tomorrow same time six o'clock and i hope you tune in maybe there'll be some more math tricks anyway thanks for today and uh yeah hope to see you tomorrow all right bye