Introduction to Problem
Solving
Evening
Enjoy the song
y
experience at
trading
Work experience in scales 1 year
session will start 9 05 pm
Today's iontent ol Faitors optimization
02 Clete if no is prime
03 Gauss s m
ou logarithmin basics
05 Sqat Int
FAQ's
ial Notes will be uploaded right after the session
Ib Assignments will be unlocked once the session
ends
Ill There is deadline for assignments
no
would highly appreciate if you guys do
it on time to avoid backlogs
try
d doubt session attendance is not counted
During
recorded Yes
Notes Yas
cel language Independent pseudocodes
Count no of faitors
01 Given N return no
of factors of N
Le factor
Is i a factor of N
Le if i completely divided N
T I to i 0
is a faitor of H if
24 to 4 0
Is 4 a
factor of 24
No of factors
191 10 1 2,5 10 4
bi 24 I 2 3,4 6 8 12,243 8
Idf Iterate from 1 to t clean
every number if it is completely
the N or not
dividing
counttoitors IN Fass 108 iterations see
int 1 0 Nitrate
T A
forli 1 ien it
11T is a factor of N
if N yo T o act
3
return c
N 109 iterations
10 iterations
108 iteration I see
I iteration sis
10 iterations 10 see
109 iteration 10 sic
s
02 10 iterations
I iteration see
g
10
s
iteration 10 see
go
10 see
s
10 iterations I 311 years
y 5 gen
You child Gran children 3
ge ga
Optimization
a 50
on I j N
max a 50
i factors of N1
j are
Tiny
I
claim If i is a factor of N
Y is also a
factor of N
IN 2
claim we can
get 14 36
all the factors i typ
i Nti in Part A
I posta 36
I post A 24
2 18
I 2 Min Mall
2 I 2
3
3 8 1 1 It g
y
4 6 6 6
Ii IN
6 4 9 4
Part B T E N Part B
g 3 12 3
2 18 2
12 2
3 I
24 I T JN
lountfactors N
int c O i Ci Ja
for i i is i
JH iteration
11 i is a factor
if IN to i 01
if i N i7 1 13
else c Ct 2
g
return count FEI
g Oz
i TEN
s
N 10 no of iterations
I Jo's 109
for 10 iterations 10 see
317
yn
countfaitors 1
If 10511
Intermediate
Increase observation skills
he Learn new technique
If a no is prime or not
Idea I lount the no
of factors
Le if c 21 prime
else not a point
Anirudh
Go sI 2 3 4 t 98 99 100
5 t 3 2 I
100 99 98 97 t
25 101 107 101 10 I t 1011101
25 101 100
s
1012th
Sum of first N natural number
S It 2 3 4 t H 2 CN i N
S CHI N 1 H 21 t t 3 2 I
25 Intel Nti Intel t t a til Intel
25 N Nti
i
1s
Perf it squares
O find
Given a number N sgrt N
t
perfect square
N 25 7 5
N 36 6
N 30 I valid test lose
N 49 7 7
int squt H1
for int i i ten itll
if Thi HI
go 2ft
breaks the function
3
Iterations la N i bl 12
1 11 Ja Id Good question
N 36 4 I 2 3 4 5 6 return 63 Giterati
N 25 I 2 3 4 5 returns 5 iteration
squt N
Note If it is not a
perfect square
then return the floor of squt ul
N 49 I 7
N 60 7 floor 7 I
floor x just smaller integer value
than 71
N 31 D S
H 36 7 6
N 27
squt H
I 5 7127 ans
int Tel ans O
I 1 1 27 1
while i ien
2 2 2 27 2
3 3 3 2 3
5 7 1
4 4 4127 4
ans 5 5 5 27 5
return
J 6 6 1127
As 5
N 9
i i ien ans
I l 19 I
0 29 10138 pm
2 2 219 2
3 3 349 3
4 4 4 9
To what power we need to
b to
raise
get a
logya c e be a
01
10928 20 8
2 23
1 1 3
02
109,25 5C 25
5 52
TEI
03 32
109232 2
2 25
C 5
16
109228 Ce y
32
05
2 210
10922
I
C 10
n
logaa
Of N 2k value of K
tal III logs L
k
logy
CLA GPT
Ask me that a estio i ne it
close D