cp's OEIS Frontend

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.

A217712 Number of primes occurring exactly once as numerators in sums generated from the set 1, 1/2, 1/3,..., 1/n.

This page as a plain text file.
%I A217712 #10 Jun 02 2013 16:00:33
%S A217712 0,1,3,3,11,13,27,54,106,168,378,142,733,1597,1283,3418,8204,10112,
%T A217712 24644,7829,32866,78136,178741,37002,256392,650596,1402914,286854,
%U A217712 2053463
%N A217712 Number of primes occurring exactly once as numerators in sums generated from the set 1, 1/2, 1/3,..., 1/n.
%C A217712 For information about how often the numerator of the generated sums is prime, see A075188 and A075189; for the largest generated prime, see A075226; for the smallest odd prime not generated, see A075227.
%e A217712 For n=3 there are the following fractions as sums of 1, 1/2 and 1/3:
%e A217712 {1/3, 1/2, 5/6, 1, 4/3, 3/2, 11/6}, three numerators are prime and they occur exactly once, therefore a(3) = A075188(3) = A075189(3) = #{3, 5, 11} = 3;
%e A217712 n=4: adding 1/4 to the previous fractions gives together: 1/4, 1/3, 1/2, 1/3+1/4=7/12, 1/2+1/4=3/4, 5/6, 1, 5/6+1/4=13/12, 1+1/4=5/4, 4/3, 3/2, 4/3+1/4=19/12, 3/2+1/4=7/4, 11/6 and 11/6+1/4=25/12:
%e A217712 A075188(4) = #{7/12, 3/4, 5/6, 13/12, 5/4, 3/2, 19/12, 7/4, 11/6} = 9,
%e A217712 A075189(4) = #{3, 5, 7, 11, 13, 19} = 6,
%e A217712 a(4) = #{11, 13, 19} = 3.
%o A217712 (Haskell)
%o A217712 import Data.Ratio ((%), numerator)
%o A217712 import Data.Set (Set, empty, fromList, toList, union, size)
%o A217712 import Data.Set (member, delete, insert)
%o A217712 a217712 n = a217712_list !! (n-1)
%o A217712 a217712_list = f 1 empty empty where
%o A217712    f x s s1 = size s1' : f (x + 1) (s `union` fromList hs) s1' where
%o A217712      s1' = g s1 $ filter ((== 1) . a010051') $ map numerator hs
%o A217712      g v []                    = v
%o A217712      g v (w:ws) | w `member` v = g (delete w v) ws
%o A217712                 | otherwise    = g (insert w v) ws
%o A217712      hs = map (+ 1 % x) $ 0 : toList s
%Y A217712 Cf. A010051.
%K A217712 nonn
%O A217712 1,3
%A A217712 _Reinhard Zumkeller_, Jun 02 2013