# 2016.1.12 기초수학 실습 장세영

## 1980 days 전, seoyo1 작성

sage: 1 in ZZ
 True True
sage: not False
 True True
sage: True and False
 False False
sage: 1 <> 0
 True True
sage: a,b=1,2
sage: c,d,e=2,3,5 sage: c,d,e
 (2, 3, 5) (2, 3, 5)
sage: c,d,e=2,3,5 sage: c,d,e
 (2, 3, 5) (2, 3, 5)
sage: f = x^2 + x + 1
sage: f = x^2 + x + 1
sage: f = x^2 + x + 1 sage: f x^2 + x + 1
 13 13
sage: 14 // 4
 3 3
sage: 14 // 4
 3 3
sage: divmod(14,4) (3, 2)
 (3, 2) (3, 2)
sage: 3.divides(15)
 True True
sage: (2^19-1).is_prime()
 True True
sage: 62.factor()
 2 * 31 2 * 31

tan(0)
 0 0
tan(pi/4)
 1 1
tan(3*pi/4)
 -1 -1
tan(pi)
 0 0
M = set({3,6,9,12,15,18})
 set([18, 3, 6, 9, 12, 15]) set([18, 3, 6, 9, 12, 15])
M.cardinality
 Traceback (click to the left of this block for traceback) ... AttributeError: 'set' object has no attribute 'cardinality' Traceback (most recent call last): File "", line 1, in File "_sage_input_43.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("TS5jYXJkaW5hbGl0eQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpMmeCEu/___code___.py", line 2, in exec compile(u'M.cardinality File "", line 1, in AttributeError: 'set' object has no attribute 'cardinality'
[tan(x) for x in [0, pi/4..pi]]
 [0, 1, Infinity, -1, 0] [0, 1, Infinity, -1, 0]
sage: divmod(956,98)
 (9, 74) (9, 74)
3.divides(15)
 True True
12.divisors()
 [1, 2, 3, 4, 6, 12] [1, 2, 3, 4, 6, 12]
(2^19-1).is_prime()
 True True
62.factor()
 2 * 31 2 * 31
24.prime_divisors()
 [2, 3] [2, 3]
gcd(14,63)
 7 7
lcm(4,5)
 20 20
3.divides(234878)
 False False
134.divisors();491.divisors();422.divisors();1002.divisors()
 [1, 2, 67, 134] [1, 491] [1, 2, 211, 422] [1, 2, 3, 6, 167, 334, 501, 1002] [1, 2, 67, 134] [1, 491] [1, 2, 211, 422] [1, 2, 3, 6, 167, 334, 501, 1002]
134.prime_divisors();491.prime_divisors();422.prime_divisors();1002.prime_divisors()
 [2, 67] [491] [2, 211] [2, 3, 167] [2, 67] [491] [2, 211] [2, 3, 167]
gcd(2,5);lcm(2,5);gcd(4,10);lcm(4,10);gcd(18,51);lcm(18,51)
 1 10 2 20 3 306 1 10 2 20 3 306
1*10;2*20;3*306
 10 40 918 10 40 918