This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A316290 #27 Aug 11 2018 20:38:42 %S A316290 0,1,1,3,2,3,2,3,4,2,3,3,2,4,4,4,2,5,4,4,4,4,6,2,3,3,6,5,5,5,3,4,4,6, %T A316290 2,5,4,4,7,5,4,6,4,3,5,6,5,3,5,6,4,5,5,3,5,6,4,6,5,5,5,6,4,5,6,6,5,4, %U A316290 5,5,6,4,6,4,5,6,5,5,4,5,4,5,6,6,6,6,6 %N A316290 a(n) is the number of ways of writing prime(n) as the sum of a prime number and a number that has only prime factors 2 and/or 5. %C A316290 Prime(n) stands for the n-th prime. %C A316290 a(58899)=0, which is the first zero after a(1)=0. %C A316290 First occurrence of k=1,2,3,...: 1, 2, 5, 4, 9, 18, 23, 39, 105, 202, 236, 321, 730, 820, ..., . - _Robert G. Wilson v_, Aug 01 2018 %e A316290 For n=2, the 2nd prime is 3, 3-1=2 is prime. This is the only case. So a(2)=1; %e A316290 ... %e A316290 For n=4, the 4th prime is 7, 7-2=5, 7-4=3, and 7-5=2 are prime. So a(4)=3; %e A316290 ... %e A316290 For n=9, the 9th prime is 23, 23-4=19, 23-10=13, 23-16=7, 23-20=3, 4 valid numbers found, so a(9)=4. %p A316290 A316290 := proc(n) %p A316290 local pri,a,p,k ; %p A316290 pri := ithprime(n) ; %p A316290 a := 0 ; %p A316290 p := 2; %p A316290 while p < pri do %p A316290 k := pri-p ; %p A316290 if nops(numtheory[factorset](k) minus {2,5}) = 0 then %p A316290 a := a+1 ; %p A316290 end if; %p A316290 p := nextprime(p) ; %p A316290 end do: %p A316290 a ; %p A316290 end proc: %p A316290 seq(A316290(n),n=1..30) ; # _R. J. Mathar_, Aug 03 2018 %t A316290 g = {1}; Table[p = Prime[n]; While[l = Length[g]; g[[l]] < p, pos = l + 1; While[pos--; c2 = g[[pos]]*2; c2 > g[[l]]]; c2 = g[[pos + 1]]*2; pos = l + 1; While[pos--; c5 = g[[pos]]*5; c5 > g[[l]]]; c5 = g[[pos + 1]]*5; c = Min[c2, c5]; AppendTo[g, c]]; ct = 0; i = 0; While[i++; cn = g[[i]]; cn < p, If[PrimeQ[p - cn], ct++]]; ct, {n, 1, 87}] %t A316290 (* Second program: *) %t A316290 Block[{nn = 450, k}, k = Sort@ Flatten@ Table[2^a * 5^b, {a, 0, Log[2, nn]}, {b, 0, Log[5, nn/(2^a)]}]; Table[Count[p - TakeWhile[k, # <= p &], _?PrimeQ], {p, Prime@ Range@ PrimePi@ nn}]] (* _Michael De Vlieger_, Jun 29 2018 *) %t A316290 twoFiveableQ[n_] := PowerMod[10, n, n] == 0; a[n_] := Block[{p = Prime@ n}, Length@ Select[p - Select[Range@ p, twoFiveableQ], PrimeQ]]; Array[a, 105] (* _Robert G. Wilson v_, Aug 01 2018 *) %o A316290 (PARI) a(n) = my(p=prime(n)); sum(k=1, p, isprime(p-k) && (k == 2^valuation(k,2)*5^valuation(k, 5))); \\ _Michel Marcus_, Aug 02 2018 %Y A316290 Cf. A003592, A303691. %K A316290 nonn,easy %O A316290 1,4 %A A316290 _Lei Zhou_, Jun 28 2018