Pls give (show) me nice variations in Lisp and Python. Thanks!!!
A happy new year! ...
44 x 44 = 1936
45 x 45 = 2025 <-- one reason that Puzzle nerds are excited today.
46 x 46 = 2116
_______________________________________
The following (in Lisp (Scheme) and Python) adds
all the numbers in a 9x9 multiplication Table. ________________________________
(print (apply +
(apply append
(map (lambda (y)
(map (lambda (x) (* x y)) (iota 9 1)))
(iota 9 1)))))
______________________________________
isum=0
for y in range(1, 10):
print()
for x in range(1, 10):
print(f"{x*y:3}", end=" ")
isum += x*y
print(' Total= ', isum, '\n')
_______________________________
kuku = [i*j for i in range(1, 10) for j in range(1, 10)]
print(sum(kuku))
(sum-each ((i 1..10) (j 1..10)) (* i j))285
(sum-each-prod ((i 1..10) (j 1..10)) (* i j))2025
https://oeis.org/A000537 ?
On Thu, 2 Jan 2025 10:54:02 +0000, yeti wrote:
https://oeis.org/A000537 ?
Sum of first n cubes; or n-th triangular number squared.
0, 1, 9, 36, 100, 225, 441, 784, 1296, 2025, 3025, 4356, 6084, 8281,
11025, 14400, 18496, 23409, 29241, 36100, 44100, 53361, 64009, 76176,
90000, 105625, 123201, 142884, 164836, 189225, 216225, 246016, 278784, 314721, 354025, 396900, 443556, 494209, 549081
Thank you... It's not obvous to me why
Sum of (consecutive) cubes would be a Square number.
(sum-each ((i 1..10) (j 1..10)) (* i j))285
(sum-each-prod ((i 1..10) (j 1..10)) (* i j))2025
Kaz Kylheku wrote:
(sum-each ((i 1..10) (j 1..10)) (* i j))285
(sum-each-prod ((i 1..10) (j 1..10)) (* i j))2025
Gauche Scheme
(use srfi-42)
(sum-ec (: i 10) (: j 10) (* i j))
===>
2025
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,064 |
Nodes: | 10 (0 / 10) |
Uptime: | 148:08:43 |
Calls: | 13,691 |
Calls today: | 1 |
Files: | 186,936 |
D/L today: |
33 files (6,120K bytes) |
Messages: | 2,410,932 |