Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Count Good Numbers

A digit string of length n is good if digits at even indices (0-based) are even and digits at odd indices are prime (2, 3, 5 or 7). Print the number of good strings of length n modulo 1,000,000,007.

Constraints

1 <= n <= 10^15

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.