caps. best news in years. v. good personal poast.
@mngrif I'm so jelly right now.
@mkb I know right!
Try to write your program before reading this - it also covers the arbitrary-set case.
How's this look?
def N(x):
if (x < 0):
return 0
if (x == 0 or x == 1):
return 1
return N(x-1) + N(x-2)
def N135(x):
if (x < 0):
return 0
if (x == 0):
return 1
return (N135(x-1) + N135(x-3) + N135(x-5))
def NArr(x, arr):
if (x < 0):
return 0
if (x == 0):
return 1
return sum([NArr(x - i, arr) for i in arr])
def main():
for n in range(10):
print(n, N(n))
for n in range(10):
print(n, N135(n))
for n in range(10):
print(n, NArr(n, [1,3,5]))
if __name__ == "__main__":
main()
Thank you for your recent comments.
You refer to the EU as a ‘consolidated power’. In a sense this is true, but so too is the USA. (I lived in Nevada for over two-and-half years – now threatened by climate change - the Colarado river, Lake Mead etc.) What matters is the history that led to its creation and provides its fundamental raison d’etre. In the case of the EU, this ultimately is not trade, but the prevention of war in wider Europe which was the cockpit of two devasting conflicts. My grandfather, along with a number of uncles as well as my late wife’s father who was born in British Guiana (as then known) in South America, put their lives on the line to defeat fascism. The latter has never gone away and in recent years has re-emerged from the shadows wearing the mask of ‘populism’ i.e. ‘the will of the people’ etc.
The desire to prevent another world war starting in Europe lies at the heart of the Treaty of Rome and was underwritten by the four freedoms enshrined in it – namely the freedom of movement of goods, services, capital and persons. Me, I believe that the ‘four freedoms’ should be extended globally. To that end, I think that all countries should aim to dismantle border controls and make ‘passports’ a thing of the past. I also believe in free markets rather than ‘command height economies’ (e.g. former USSR), However, most free markets are not fair because they are rigged (cartels and monopolies) and most regulatory bodies are stuffed with industry insiders and, for that reason alone, can never be effective. But there are many other freedoms that need to be enshrined in international law. For example, the right to privacy, the right to cognitive liberty (including ending the so-called ‘War on Drugs’), the right to freedom from poverty (Basic Income to replace means-tested state benefits). I also believe that 14-year-olds should be given the vote. And so on and so forth…
The EU is confronting many problems. It needs to undergo serious reforms. However, at the end of the day, I believe it to be an heir of the Renaissance and the Enlightenment. Compared to the ridiculous shenanigans at Westminster in recent years, it is a beacon of civility and serious forward-thinking. Yes, it makes mistakes. Yes, it is occasionally overbearing. However, its sins are trivial when compared to those of national governments. Paradoxically, Brexit has strengthened rather than weakened its hand. In the Netherlands those in favour of remaining in the EU stands at roughly 72% even though the population is increasingly confused on the subject. Many countries are seeking to join the Union (Bosnia, Moldova, Albania and indeed, still, Turkey). I understand that multi-lateralism is anathema to Trump and Putin, but to be honest, that’s their problem, not mine.
Finally, while I agree that if the UK were to leave the EU without a deal, new trade deals would take place, they would be slow in the making and leave the UK significantly worse off. You don’t need to believe me, you just need to poll any reasonably informed person in the Commonwealth, Japan, Far East Asia or the Antipodes!
Best (me – “just relaxed and paying attention” (or trying to))!
Try to write your program before reading this - it also covers the arbitrary-set case.
Okay, so with all that, here is the actual longhand using the permutations, but I am not sure how to handle this if I passed an array of numbers like in the 1,3,5 example
def NFact(x):
def fact(x):
_fact = 1
for i in range(1, x+1):
_fact = _fact * i
return _fact
def r_NFact(num):
twos = x - num
ones = x - (2 * twos)
if ones < 0:
return 0
return r_NFact(num - 1) + ( fact(num) // (fact(ones) * fact(twos)))
return r_NFact(x)
@mngrif That just means your parents are getting old. Its when the rest of your family except you is getting the funeral home spam that that you have to worry :)
"You refer to the EU as a ‘consolidated power’. In a sense this is true, but so too is the USA."
YEs that is true. I am also very vocal about the consolidated power in the USA government is exactly why we now have rampant corruption and politicians that have the emotional IQ of a toddler. It is exactly the lesson from America (as someone who fled america) that I bring to the EU and exactly the reason why i dont want to see the EU go down the same destructive path as it already has.
I agree that the goal of the EU in its early days was a good one. As someone who moved here to the EU I've tried to discuss and study it as best I can. In its early form and early intention it wasnt so bad. But it has gone far far FAR beyond a trade union or a means of preventing war. Now it is a beast with regulatory and legal restrictions on its member states that should not be acceptable to any voter IMO
I do agree that brexit right now has strengthened support for the EU. The EU manipulated people expertly and while acting dishonestly to keep the UK in they managed to dupe everyone into thinking it was the UK's fault for the poor decision. However I have no doubt that if and when the UK exits once they see all the doomsday BS was false and that in fact the UK thrives outside the EU that that opinion will shift very quickly. All the more reason the EU is desperate to make sure that doesnt happen.
Yea the dems act like children having a temper tantrum and hit him. Then donald trump sinks to their level, behaves like a 5 year old in the throws of the same temper tantrum and "hits back"... All I see are a bunch of immature babies pretending to be adults.
@requiem fair, good plan :)
@requiem Police are definately a big issue. I too include the violence in my every day life. I fled america because of the violence i saw day to day from the democrats I used to support. Mostly for being critical of the democratic party on certain issues which made people accuse me of beinf a republican despite always having voted democrat. After the death threats over nonsense I fled. Now im in another country and forced to vote remotely and for the first time ever I might even have to consider replicans, I dunno, that or third party.
@requiem I dunno, could be true of course. But what i witnessed lately was very much the opposite.
Both sides seem to have an extreme hate for anyone different from the demographic of their "side" in general. But the left seems to be the one doing the vast majority of the violence based on my own personal expiernces as someone who spend a good time at political rallies of both sides as a neutral observer.
@jasper could be their just friends, could be a business relationship, could be both. I'm still not sure i see the problem but id have to watch the episode where he is on and what was said to really judge. If there was no lying or clear deceptions i may not see a problem in that
@requiem whats that?
@requiem Ahh, is that common in your area among trump supporters. As much as I hate trump nearly 100% of the violence i personally witnessed back where i lived was from liberals and directed at Republicans. A large part of why i had to flee the states in fact.
I am not republican but it did make me fear for my life
@requiem If you mean that you literally get violent then that is rather disturbing. If you just mean your more cautious then I understand to a point,
Some cool science learned from Zebras.
I mean trumps kids, and biden, have both been over my family home. Pretty sure I'm less worried about your political influence than my own really.
**I'm** not worried :)
Jeffrey Phillips Freeman
Innovator & Entrepreneur in Machine Learning, Evolutionary Computing & Big Data. Avid SCUBA diver, Open-source developer, HAM radio operator, astrophotographer, and anything nerdy.
Born and raised in Philadelphia, PA, USA, currently living in Utrecht, Netherlands, USA, and Thailand. Was also living in Israel, but left.
Pronouns: Sir / Mister
(Above pronouns are not intended to mock, i will respect any persons pronouns and only wish pronouns to show respect be used with me as well. These are called neopronouns, see an example of the word "frog" used as a neopronoun here: http://tinyurl.com/44hhej89 )
A proud member of the Penobscot Native American tribe, as well as a Mayflower passenger descendant. I sometimes post about my genealogical history.
My stance on various issues:
Education: Free to PhD, tax paid
Abortion: Protected, tax paid, limited time-frame
Welfare: Yes, no one should starve
UBI: No, use welfare
Racism: is real
Guns: Shall not be infringed
LGBT+/minorities: Support
Pronouns: Will respect
Trump: Moron, evil
Biden: Senile, racist
Police: ACAB
Drugs: Fully legal, no prescriptions needed
GPG/PGP Fingerprint: 8B23 64CD 2403 6DCB 7531 01D0 052D DA8E 0506 CBCE