Special numbers
Practice
2.8 (33 votes)
Basic programming
Math
Number theory
Problem
89% Success 7587 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
A natural number is special if it consists of only digits \(4\) and \(7\). Find the number of pairs of сoprime special numbers \((x,\ y)\) such that \(1 ⩽ x ⩽ y ⩽ N\).
Input format
The first line contains an integer \(N\) (\(1 ⩽ N ⩽ 10^9\)).
Output format
Print a single number denoting the answer to the problem.
Explanation
Clarification: https://en.wikipedia.org/wiki/Coprime_integers
Answer = 1 because 4 and 7 \(\le\) 10 and gcd(4,7) = 1
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:20
104 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpen
Points:20
6 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementationMath
Points:20
25 votes
Tags:
ApprovedEasy
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor