Showing posts with label প্রোজেক্ট ইউলার. Show all posts
Showing posts with label প্রোজেক্ট ইউলার. Show all posts

Projecteuler -- 21 (Amicable numbers)

Solution :  If you don't understand the solution process I will recommend you to go my blog's algorithm section and search "Divisor কথন" and read it hope you will understand.


problem Description : Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220.
Evaluate the sum of all the amicable numbers under 10000.



Project Euler -- 48 (Self powers)

Problem : The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.

My solution approach is,

first made a smaller version of the problem then I tried to solve it after solving this I was going to solve the bigger version.

// a. find out p=2^15

// b. print the last digit of p







প্রোজেক্ট ইউলার প্রবলেম # 12












                                                         

 Problem link : https://projecteuler.net/problem=12 


Highly divisible triangular number

Problem 12

The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
 1: 1
 3: 1,3
 6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that 28 is the first triangle number to have over five divisors.
What is the value of the first triangle number to have over five hundred divisors?

Solution :

প্রোজেক্ট ইউলার প্রবলেম # 06

problem link (Sum square difference) 

Problem Description : 


The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.


খুবই বাংলা প্রবলেম ক্লাস 8/9 এর পোলাপানেরাও পারবে। n(n+1)/2 এই ফর্মুলা ব্যাবহার করা হইসে বাকিটা সহজ যে কেউ পড়লেই বুঝবে । 



প্রোজেক্ট ইউলার প্রবলেম # 07

 Problem Link: Project Euler Problem # 07 (10001st Prime) 

সিভের অ্যালগরিদম দিয়ে প্রবলেম টি সল্ভে করছি, তাই সিভের অ্যালগরিদম আগে শিখে নেন। প্রবলেমটির মাঝে কোন জটিলতা নাই খুবই সিম্পল প্রবলেম। কোডে যথেষ্ট পরিমাণ কমেন্ট-আউট করছি বোঝার সুবিধার জন্য।



প্রোজেক্ট ইউলার প্রবলেম 04

problem Link 

problem:

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.

বাংলা প্রবলেম, তবে একটা সমস্যা execution time অনেক বেড়ে যাবে যদি লুপ দিয়ে করেন। যাই হোক নিচের কোডটি যথেষ্ট efficient।



প্রোজেক্ট ইউলার সমস্যা ০৯ (Pythagorean Triples)

প্রবলেমঃ A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.


সমাধানঃ সমস্যাটি সমাধান করার আগে, Pythagorean Triples নিয়ে বিস্তারিত এই লেখাটি পড়ে নিতে পারেন 





Projecteuler.net সাইটে আপনার সমাধান সঠিক হলে আপনি ঐ সমাধানের একটি উপর বিস্তারিত অ্যালগরিদম সহ একটি pdf file পাবেন যেখানে ঐ সমস্যা সমাধানের জন্য কি থিওরি ব্যাবহার করতে হবে সব বিস্তারিত ব্যাখ্যা করা আছে। তবে সমাধান না করা পর্যন্ত আপনি pdf file টি পাবেন না। নিচে ফাইলটির ডাউনলোড লিংক দেওয়া আছে ডাউনলোড করে নিতে পারেন।


পিথাগোরাসের ত্রিপদ (Pythagorean Triples)


•Pythagorean Triples  এর সংজ্ঞা এভাবে দেয়া যায় – A Pythagorean Triples is a set of positive integer where  a, b  and  c that fits the rule a²+b²=c².

Peojecteuler.net  এর একটি প্রবলেম সল্ভ করতে গিয়ে Pythagorean Triples এর একটি প্রবলেম পাই, সেটা নিয়ে মাথা ঘামাতে গিয়ে কয়েকটি বিষয় জানতে পারলাম। চেষ্টা করব বিষয় গুলো বিস্তারিত বলার।

প্রথমেই পিথাগোরাসের সুত্র,
            a²+b² =c²  (যেখানে a<b<c)   কখনই a=b=c  হলে পিথাগোরাসের ত্রিভুজ হবে না।

সবচেয়ে ছোট Pythagorean Triples হচ্ছ 3²+4²=5²   (3<4<5)

“Pythagorean Triples  অসীম” 

•যেকোনো সংখ্যা n (n>1) তাহলে 3n, 4n and 5n  একটি Pythagorean Triples কারন
(3n)²+(4n)²=(5n)²  সত্য, যেখানে n={ integer  নাম্বারের সেট} ,
তার মানে n যখন অসীম তখন Pythagorean Triples ও অসীম।

Pythagorean Triples এর কয়েকটি বৈশিষ্ট্য সব সময় থাকবে,

১. Pythagorean Triples এর সবগুলো সংখ্যা জোড় হবে।
২. দুটি সংখ্যা বিজোড় একটি জোড় সংখ্যা হবে।

Pythagorean Triples এ কখনই সবগুলো সংখ্যা বিজোড় বা দুটি জোড় একটি বিজোড় সংখ্যা হবে না, কারন:

# বিজোড় সংখ্যার বর্গ সবসময় বিজোড় এবং জোড় সংখ্যার বর্গ সবসময় জোড় সংখ্যা হবে।
# দুটি জোড় সংখ্যার যোগফল সন্সময় সবসময় জোড় সংখ্যা এবং দুটি বিজোড় সংখ্যার যোগফল বিজোড় সংখ্যা হবে।

            6²+8²=12²     Pythagorean Triplet  নয় কারন ১১৭=১৪৪ (মিথ্যা)

Pythagorean Triples এর a, b, c এর মান বের করার একটি algorithm আছেঃ

যখন m এবং n দুটি ধনাত্মক পূর্ণ সংখ্যা (m<n)

a=n²-m²
b=2.n.m
c=n²+m²

m=7  এবং n=8 ধরা যাক

a=8²-7²=15
b=2.8.7=112
c=8²+7²=113

•a²+b²=c²
15²+112²=113²    • 12769=12769  (True)

তাহলে দেখা যাচ্ছে n এবং m এর যেকোনো মানের জন্য একটি Pythagorean Triples পাওয়া যাবে এবং তা সবসময় সত্য হবে।


এই পোস্টটি একটি ওয়ার্ম-আপ projecteuler.net এর ৯ নাম্বার সমস্যাটি সমাধান করার জন্য।


প্রোজেক্ট ইউলার সমস্যা ০৯ (Pythagorean Triples)