Tap here to switch tabs
Problem
Submissions

Problem: Count Good Numbers

Try to solve the Count Good Numbers problem.

Statement

A digit string is considered good if the digits at even indices (starting from index 00) are even (00, 22, 44, 66, or 88) and the digits at odd indices are prime (22, 33, 55, or 77).

Given an integer n, return the total number of good digit strings of length n. Since the answer may be large, return it modulo 109+710^9 + 7.

Note: A digit string may contain leading zeros, and indices are numbered starting from 00 from left to right.

Constraints:

  • 1≤1 \leq n ≤1015\leq 10^{15}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Good Numbers

Try to solve the Count Good Numbers problem.

Statement

A digit string is considered good if the digits at even indices (starting from index 00) are even (00, 22, 44, 66, or 88) and the digits at odd indices are prime (22, 33, 55, or 77).

Given an integer n, return the total number of good digit strings of length n. Since the answer may be large, return it modulo 109+710^9 + 7.

Note: A digit string may contain leading zeros, and indices are numbered starting from 00 from left to right.

Constraints:

  • 1≤1 \leq n ≤1015\leq 10^{15}