搜尋此網誌

2026年9月3日星期四

quiz

def triangle(num):

    if num == 1:

        return num

    return num + triangle(num - 1)

Your function triangle(num) is a recursive way to calculate the triangular number — the sum of all integers from 1 up to num.

How it works

  • Base case: If num == 1, it returns 1.

  • Recursive case: Otherwise, it returns num + triangle(num - 1), which keeps calling itself until it reaches 1.

So for triangle(4):

  • 4 + triangle(3)

  • 4 + (3 + triangle(2))

  • 4 + (3 + (2 + triangle(1)))

  • 4 + 3 + 2 + 1 = 10

Key points

  • It computes the sum 1+2++n.

  • This is known as the n-th triangular number.

  • Formula: n(n+1)2

小學奧數口訣︰頭項加尾項乘項數除二

def square(num):

    return triangle(num-1) + triangle(num)


Explanation

  • triangle(n) gives the sum of integers from 1 to n. Example: triangle(4) = 1+2+3+4 = 10.

  • In your square(num) function, you’re adding:

    • triangle(num-1) → sum of numbers up to num-1

    • triangle(num) → sum of numbers up to num

If num = 4
square(4) = 16
triangle(3) + tringle(4) = 6 + 10 = 16


Microsoft Copilot

強化與減弱

dwell on: to think or talk a lot about something, especially something it would be better to forget

reframe: to frame (something) again and often in a different way

indicative: a form in the indicative mood

Long-term potentiation (LTP) is a long-lasting increase in the strength of synaptic connections between neurons, triggered by repeated or high-frequency stimulation.

Long-term depression (LTD) in neuroscience is an activity-dependent reduction in the strength of neuronal synapses that lasts for hours or longer.

Opposite of LTP: While long-term potentiation (LTP) strengthens connections, LTD weakens them to balance brain activity and clear space for new information.

LTP 與 LTD 共同構成神經可塑性的雙向調節,支援 Hebbian 學習與記憶的形成與修正。它們也出現在時序依賴性突觸可塑性(Spike-timing-dependent plasticity, STDP)中,依據前後脈衝時差決定增強或抑制。總體上,LTP 強化有用的連結,LTD 削弱冗餘或錯誤的連結,維持網路穩定與資訊儲存效率。

Hebbian theory states that connections between neurons strengthen when they are activated repeatedly at the same time. Often summarized by the phrase: "Neurons that fire together, wire together".

substitute: to take the place of somebody/something else; to use somebody/something instead of somebody/something else

sever: to cut something into two pieces; to cut something off something

dismantle: to take apart a machine or structure so that it is in separate pieces

Nicole Vignola "Rewire"

hk.dictionary.search.yahoo.com

oxfordlearnersdictionaries.com

www.merriam-webster.com

Google AI overview

Explained by Microsoft Copilot