Hackwithinfy | Online Assessment | Playing with prime

Given an intger N
N<=1e50
Output the no. of pairs (x,y) such that

  1. 0<=x<=n
  2. 0<=y<=n
  3. F(x) +F(y) =Prime no.
    F(x) = sum of digits of x

(x,y) and (y,x) are to be treated as same pair
example 1
3
ouput
5
explaination
5 pairs (0,2) (1,1) (0,3) (2,3)(1,2) give prime no.s

Comments (10)