A075188
Number of times that the numerator of a sum generated from the set 1, 1/2, 1/3,..., 1/n is prime.
Original entry on oeis.org
0, 1, 3, 9, 19, 43, 79, 162, 307, 607, 1075, 2186, 3872, 7573, 15101, 29139, 52295, 104953, 189915, 379275, 754081, 1462115, 2675851, 5351541, 10254019, 19987942, 38901233, 77620568, 144021667, 288428481, 537642772, 1056802340, 2113152353, 4138261885
Offset: 1
a(3) = 3 because 3 sums yield prime numerators: 1+1/2 = 3/2, 1/2+1/3 = 5/6 and 1+1/2+1/3 = 11/6.
-
import Data.Ratio (numerator)
a075188 n = a075188_list !! (n-1)
a075188_list = f 1 [] where
f x hs = (length $ filter ((== 1) . a010051') (map numerator hs')) :
f (x + 1) hs' where hs' = hs ++ map (+ recip x) (0 : hs)
-- Reinhard Zumkeller, May 28 2013
-
Needs["DiscreteMath`Combinatorica`"]; maxN=20; For[cnt=0; lst={}; i=0; n=1, n<=maxN, n++, While[i<2^n-1, i++; s=NthSubset[i, Range[n]]; k=Numerator[Plus@@(1/s)]; If[PrimeQ[k], cnt++ ]]; AppendTo[lst, cnt]]; lst
A075189
Number of distinct primes in the numerator of the 2^n sums generated from the set 1, 1/2, 1/3, ..., 1/n.
Original entry on oeis.org
0, 1, 3, 6, 14, 20, 38, 74, 134, 232, 486, 526, 1078, 2036, 2505, 4762, 9929, 14598, 29831, 31521, 52223, 101123, 207892, 215796, 426772, 836665, 1640357, 1689653, 3401483, 3471770, 6868800, 13470379, 23182192, 45792615, 47136366
Offset: 1
a(3) = 3 because 3 sums yield distinct prime numerators: 1+1/2 = 3/2, 1/2+1/3 = 5/6 and 1+1/2+1/3 = 11/6.
-
import Data.Ratio ((%), numerator)
import Data.Set (Set, empty, fromList, toList, union, size)
a075189 n = a075189_list !! (n-1)
a075189_list = f 1 empty empty where
f x s s1 = size s1' : f (x + 1) (s `union` fromList hs) s1' where
s1' = s1 `union` fromList
(filter ((== 1) . a010051') $ map numerator hs)
hs = map (+ 1 % x) $ 0 : toList s
-- Reinhard Zumkeller, May 28 2013
-
Needs["DiscreteMath`Combinatorica`"]; maxN=20; For[lst={}; prms={}; i=0; n=1, n<=maxN, n++, While[i<2^n-1, i++; s=NthSubset[i, Range[n]]; k=Numerator[Plus@@(1/s)]; If[PrimeQ[k], prms=Union[prms, {k}]]]; AppendTo[lst, Length[prms]]]; lst
A075227
Smallest odd prime not occurring in the numerator of any of the 2^n subset sums generated from the set 1/1, 1/2, 1/3, ..., 1/n.
Original entry on oeis.org
3, 5, 7, 17, 37, 43, 43, 151, 151, 409, 491, 491, 491, 1087, 2011, 3709, 3709, 7417, 7417, 7417, 19699, 30139, 35573, 35573, 40237, 40237, 132151, 132151, 158551, 158551, 245639, 245639, 961459, 1674769, 1674769, 1674769, 1674769, 4339207
Offset: 1
a(3) = 7 because 7 is the smallest prime not occurring in the numerator of any of the sums 1/1 + 1/2 = 3/2, 1/1 + 1/3 = 4/3, 1/2 + 1/3 = 5/6 and 1/1 + 1/2 + 1/3 = 11/6.
-
import Data.Ratio ((%), numerator)
import Data.Set (Set, empty, fromList, toList, union)
a075227 n = a075227_list !! (n-1)
a075227_list = f 1 empty a065091_list where
f x s ps = head qs : f (x + 1) (s `union` fromList hs) qs where
qs = foldl (flip del)
ps $ filter ((== 1) . a010051') $ map numerator hs
hs = map (+ 1 % x) $ 0 : toList s
del u vs'@(v:vs) = case compare u v
of LT -> vs'; EQ -> vs; GT -> v : del u vs
-- Reinhard Zumkeller, May 28 2013
-
Needs["DiscreteMath`Combinatorica`"]; maxN=20; For[lst={}; prms={}; i=0; n=1, n<=maxN, n++, While[i<2^n-1, i++; s=NthSubset[i, Range[n]]; k=Numerator[Plus@@(1/s)]; If[PrimeQ[k], AppendTo[prms, k]]]; prms=Union[prms]; j=2; While[MemberQ[prms, Prime[j]], j++ ]; AppendTo[lst, Prime[j]]]; lst
(* Second program; does not need Combinatorica *)
a[1] = 3; a[2] = 5; a[n_] := For[nums = (Total /@ Subsets[1/Range[n]]) // Numerator // Union // Select[#, PrimeQ]&; p = 3, p <= Last[nums], p = NextPrime[p], If[FreeQ[nums, p], Print[n, " ", p]; Return[p]]];
Table[a[n], {n, 1, 23}] (* Jean-François Alcover, Sep 10 2017 *)
-
from sympy import sieve
from fractions import Fraction
fracs, newnums, primeset = {0}, {0}, set(sieve.primerange(3, 10**6+1))
for n in range(1, 24):
newfracs = set(Fraction(1, n) + f for f in fracs)
fracs |= newfracs
primeset -= set(f.numerator for f in newfracs)
print(min(primeset), end=", ") # Michael S. Branicky, May 09 2021
A217712
Number of primes occurring exactly once as numerators in sums generated from the set 1, 1/2, 1/3,..., 1/n.
Original entry on oeis.org
0, 1, 3, 3, 11, 13, 27, 54, 106, 168, 378, 142, 733, 1597, 1283, 3418, 8204, 10112, 24644, 7829, 32866, 78136, 178741, 37002, 256392, 650596, 1402914, 286854, 2053463
Offset: 1
For n=3 there are the following fractions as sums of 1, 1/2 and 1/3:
{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;
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:
A075188(4) = #{7/12, 3/4, 5/6, 13/12, 5/4, 3/2, 19/12, 7/4, 11/6} = 9,
A075189(4) = #{3, 5, 7, 11, 13, 19} = 6,
a(4) = #{11, 13, 19} = 3.
-
import Data.Ratio ((%), numerator)
import Data.Set (Set, empty, fromList, toList, union, size)
import Data.Set (member, delete, insert)
a217712 n = a217712_list !! (n-1)
a217712_list = f 1 empty empty where
f x s s1 = size s1' : f (x + 1) (s `union` fromList hs) s1' where
s1' = g s1 $ filter ((== 1) . a010051') $ map numerator hs
g v [] = v
g v (w:ws) | w `member` v = g (delete w v) ws
| otherwise = g (insert w v) ws
hs = map (+ 1 % x) $ 0 : toList s
A256222
Largest Fibonacci number in the numerator of the 2^n sums generated from the set 1, 1/2, 1/3, ..., 1/n.
Original entry on oeis.org
0, 1, 3, 5, 13, 13, 13, 89, 89, 89, 1597, 1597, 1597, 1597, 1597, 1597, 17711, 17711, 17711, 28657, 28657, 28657, 28657, 1346269, 1346269, 1346269, 1346269, 24157817, 24157817, 24157817, 24157817, 24157817, 24157817, 39088169, 39088169, 39088169, 39088169
Offset: 0
a(3) = 5 because we obtain the 5 subsets {1}, {1/2}, {1/3}, {1,1/2} and {1/2, 1/3} having 5 sums with Fibonacci numerators: 1, 1, 1, 1+1/2 = 3/2 and 1/2+1/3 = 5/6 => the greatest Fibonacci number is 5.
-
<<"DiscreteMath`Combinatorica`"; maxN=24; For[t={}; mx=0; i=0; n=0, n<=maxN, n++, While[i<2^n-1, i++; s=NthSubset[i, Range[n]]; k=Numerator[Plus@@(1/s)]; If[IntegerQ[Sqrt[5*k^2+4]]||IntegerQ[Sqrt[5*k^2-4]], If[k>mx, t=s]; mx=Max[mx, k]]]; Print[mx]]
Showing 1-5 of 5 results.
Comments