LUCIFER  LUCIFER Number
Lucifer is the only human whi has defeated RAONE in a computer game ..
RAOne is after lucifer for revenge and GOne is there to protect him ...
All thi GOne and Raone Nonsense has disturbed lucifers life..
He wants to get Rid of RaOne and kill him . He found that RaOne can be killed only by throwing Lucifer number of weapons at him.
Lucifer number shares the some properties of RaOne Numbers numbers and GOne Numbers
Any number is LUCIFER NUMBER if the Difference between Sum of digits at even location and Sum of digits at odd location is prime number .. For eg... for 20314210 is lucifer number
digits at odd location 0,2,1,0
digits at even location 1,4,3,2
diff = (1+4+3+2)(0+2+1+0)=103 = 7 ..... a prime number.
Lucifer has access to a Warehouse which has lots of weapons ..
He wants to know in how many ways can he kill him.
Can you help him?
Input
First line will have a number 't' denoting the number of test cases.
each of the following t lines will have 2 numbers 'a' , 'b'
Output
Print single number per test case, depicting the count of Lucifer numbers in the range a,b inclusive.
Example
Input:
5
200 250
150 200
100 150
50 100
0 50
Output:
2
16
3
18
6NOTE: t will be less than 100
from and to will be between 0 and 10^9 inclusive
hide comments
bhagirathi08:
20190908 11:10:03
My 2nd digit dp problem, AC in one go HOLLAHhhhhh..... 

iceelement:
20190125 03:56:21
I think this question requires further clarifications. Difference here means the signed difference between even and odd positions. The positioning is considered from right to left with 1 based indexing. Negative numbers are not considered prime, even if their absolute value is prime. 

puddin:
20180705 01:01:38
Can someone pls explain how the ans for test case 0 50 is 6 as I am getting 14 for it. 

aman_sachin200:
20180606 01:04:23
This felt so good!!AC in 1 go!!My first digit dp :) 

sdssudhu:
20180124 17:52:29
AC in one GO;) 

sfialok98:
20170628 10:25:08
Learnt so much..


Nafis Islam:
20170620 14:38:04
my first digit dp :D 

wh1t3_r0s3:
20170427 19:19:41
recursion without memoization is getting accepted too 

sieunhanbom04:
20170320 16:58:19
:'( ACed. So good 

sprof:
20160724 23:25:00
Last edit: 20160724 23:43:59 
Added by:  Devil D 
Date:  20120309 
Time limit:  0.100s0.5s 
Source limit:  10000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Own 