### Sukarna_Paul's blog

By Sukarna_Paul, history, 6 days ago, ,

This problem is from ACM ICPC Dhaka Regional 2018 (Contest Link)

How can I approach for this problem?

Problem Satement:

The function d(n) denotes the number of positive divisors of an integer n. For example d(24) = 8, because there are 8 divisors of 24 and they are 1, 2, 3, 4, 6, 8, 12 and 24. The function sndd(n) is a new function defined for this problem. This denotes “The summation of number of divisors of the divisors” of an integer n. For example,

sndd(24) = d(1) + d(2) + d(3) + d(4) + d(6) + d(8) + d(12) + d(24) = 1 + 2 + 2 + 3 + 4 + 4 + 6 + 8 = 30.

Given the value of n, you will have to find sndd(n!), here n! means factorial of n. So n! = 1 × 2 × 3 × … × n.

Input The input contains at most 1000 lines of test cases. Each line contains a single integer that denotes a value of n (1 ≤ n ≤ 10^6). Input is terminated by a line containing a single zero.

Output For each line of input produce one line of output. This line contains an integer that denotes the modulo 10000007 (or 10^7 + 7) value of sndd(n).

Sample Input 4 5 0

Sample Output 30 90

•
• +5
•

By Sukarna_Paul, history, 4 weeks ago, ,

By Sukarna_Paul, history, 2 months ago, ,

How can I approach for this Geometry problem . Here is the link URI 1291

By Sukarna_Paul, history, 2 months ago, ,

How can I approach for this problem Problem Link

•
• +3
•

By Sukarna_Paul, history, 3 months ago, ,

How can I approach for this number theory problem ? [Problem Link](http:// https://codeforces.com/contest/1070/problem/A)

A. Find a Number time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output

You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.

Input The first line contains two positive integers d and s (1≤d≤500,1≤s≤5000) separated by space.

Output Print the required number or -1 if it doesn't exist.

Examples input 13 50 output 699998

input 61 2 output 1000000000000000000000000000001

input 15 50 output -1

By Sukarna_Paul, history, 3 months ago, ,

How can I approach for this problem ?

The number of divisor function or d(n) is a very interesting function in number theory. It denotes the number of positive divisors of a particular number. For example d(24) = 8 as 24 has eight divisors 1, 2, 3, 4, 6, 8, 12 and 24 . In mathematics factorial of a positive integer number n is written as n! and is defined as below: n! = 1 × 2 × 3 × · · · × n

Another interesting function AF(n) (Again factorial in short) is defined as: AF(n) = 1! × 2! × 3! × . . . × n!

Given n , your job is to find the value of d(AF(n)).

Input The input file contains at most 101 lines of inputs. Each line contains an integer n (0 < n < 5000001) . Input is terminated by a line containing a single zero. This value should not be processed.

Output For each line of input produce one line of output.

This line contains the modulo 100000007 (10^8 + 7) of d(AF(n)).

Sample Input 1 2 3 4 100 0

Sample Output 1 2 6 18 59417661

•
• +1
•

By Sukarna_Paul, history, 6 months ago, ,

Some Big integer problems for beginners Solving BigInteger Problem is fun. There are many problem solvers around the world who come to use Java BigInteger class though they do not code in Java usually. Here are some simple problems with their links and solution. This problem are chosen from different online judges. Try yourself before you see the solution.

Codeforces Gym : 112

# Solution

import java.util.Scanner ;
import java.math.BigInteger;
public class Main{
public static void main(String[] args){
int a,b;
Scanner input = new Scanner(System.in);
a = input.nextInt();
b = input.nextInt();
BigInteger A = BigInteger.valueOf(a);
BigInteger B= BigInteger.valueOf(b);
System.out.printf("%d",A.pow(b).subtract(B.pow(a)));

}
}


Uva 10183 — How Many Fibs?

# Solution

import java.util.*;
import java.math.*;
public class Main{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
BigInteger arr[] = new BigInteger[50000];
arr[0]= BigInteger.valueOf(1);
arr[1]= BigInteger.valueOf(2);
for(int i=2;i<50000;i++){
}
while(true){

BigInteger a,b;
a = input.nextBigInteger();
b = input.nextBigInteger();
if(b.compareTo(BigInteger.valueOf(0))==0){
break;
}
int count=0;
for(int i=0;i<50000;i++){
if(arr[i].compareTo(a)>=0 && arr[i].compareTo(b)<=0){
count++;
}
if(arr[i].compareTo(b)>0){
break;
}
}
System.out.println(count);
}
}
}


URI 1279

# Solution

import java.util.*;
import java.math.*;
import java.io.*;
public class Main{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
boolean start = true;
while(input.hasNext()){
boolean leap_year = false;
boolean ordinary = true;
if(start == false){
System.out.print("\n");
}
start = false;
BigInteger year;
year = input.nextBigInteger();
BigInteger four;
four = BigInteger.valueOf(4);
BigInteger fourh;
fourh = BigInteger.valueOf(400);
BigInteger oneh;
oneh = BigInteger.valueOf(100);
BigInteger temp = year.remainder(four);
if(temp.compareTo(BigInteger.valueOf(0))==0){
temp = year.remainder(oneh);
if(temp.compareTo(BigInteger.valueOf(0))==0){
temp = year.remainder(fourh);
if(temp.compareTo(BigInteger.valueOf(0))==0){
System.out.println("This is leap year.");
leap_year = true;
ordinary = false;
}
}
else{
System.out.println("This is leap year.");
leap_year = true;
ordinary = false;
}
}
temp = year.remainder(BigInteger.valueOf(15));
if(temp.compareTo(BigInteger.valueOf(0))==0){
System.out.println("This is huluculu festival year.");
ordinary = false;
}
if(leap_year==true){
temp = year.remainder(BigInteger.valueOf(55));
if(temp.compareTo(BigInteger.valueOf(0))==0){
System.out.println("This is bulukulu festival year.");
ordinary = false;
}
}
if(ordinary == true){
System.out.println("This is an ordinary year.");
}
}
}
}


Project Euler Problem 13

# Solution

import java.util.*;
import java.math.*;

public class problem13{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
BigInteger sum, a;
sum = BigInteger.valueOf(0);
for(int i=0;i<100;i++){
a = input.nextBigInteger();
}
System.out.println(sum);    //take the first 10 digits manually
}
}


Project Euler Problem 15

# Solution

import java.math.*;

public class Problem15{
public static void main(String[] args){
BigInteger n=BigInteger.valueOf(1);
BigInteger ans=BigInteger.valueOf(1);
for(int i=0;i<40;i++){
ans=ans.multiply(n);
}
n=BigInteger.valueOf(1);
BigInteger ans2=BigInteger.valueOf(1);
for(int i=0;i<20;i++){
ans2=ans2.multiply(n);
}
System.out.println(ans.divide(ans2.multiply(ans2)));
}
}


Project Euler Problem 16

# Solution

import java.math.*;

public class Problem16{
public static void main(String[] args){
//BigInteger n=BigInteger.valueOf(1000);
BigInteger two = BigInteger.valueOf(2);
BigInteger ans = two.pow(1000);
String s = ""+ans;
System.out.println(s);
int sum=0;
for(int i=0;i<s.length();i++){
sum+=s.charAt(i)-'0';
}
System.out.println(sum);
}
}


Thank you. Happy coding.