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.

A174090 Powers of 2 and odd primes; alternatively, numbers that cannot be written as a sum of at least three consecutive positive integers.

This page as a plain text file.
%I A174090 #70 Oct 25 2024 02:26:24
%S A174090 1,2,3,4,5,7,8,11,13,16,17,19,23,29,31,32,37,41,43,47,53,59,61,64,67,
%T A174090 71,73,79,83,89,97,101,103,107,109,113,127,128,131,137,139,149,151,
%U A174090 157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,256
%N A174090 Powers of 2 and odd primes; alternatively, numbers that cannot be written as a sum of at least three consecutive positive integers.
%C A174090 From _Omar E. Pol_, Feb 24 2014: (Start)
%C A174090 Also the odd noncomposite numbers (A006005) and the powers of 2 with positive exponent, in increasing order.
%C A174090 If a(n) is composite and a(n) - a(n-1) = 1 then a(n-1) is a Mersenne prime (A000668), hence a(n-1)*a(n)/2 is a perfect number (A000396) and a(n-1)*a(n) equals the sum of divisors of a(n-1)*a(n)/2.
%C A174090 If a(n) is even and a(n+1) - a(n) = 1 then a(n+1) is a Fermat prime (A019434). (End)
%H A174090 Robert Israel, <a href="/A174090/b174090.txt">Table of n, a(n) for n = 1..10000</a>
%H A174090 Jaap Spies, <a href="http://www.jaapspies.nl/bookb5.pdf">A Bit of Math, The Art of Problem Solving</a>, Jaap Spies Publishers (2019).
%H A174090 Nieuw Archief voor Wiskunde, <a href="http://www.jaapspies.nl/mathfiles/problem2005-2C.pdf">Problems/UWC, Problem C</a>, Vol. 5/6, No. 2.
%F A174090 a(n) ~ n log n. - _Charles R Greathouse IV_, Sep 19 2024
%p A174090 N:= 300: # to get all terms <= N
%p A174090 S:= {seq(2^i,i=0..ilog2(N))} union select(isprime,{ 2*i+1 $ i=1..floor((N-1)/2) }):
%p A174090 sort(convert(S,list)); # _Robert Israel_, Jun 18 2015
%t A174090 a[n_] := Product[GCD[2 i - 1, n], {i, 1, (n - 1)/2}] - 1;
%t A174090 Select[Range[242], a[#] == 0 &] (* _Gerry Martens_, Jun 15 2015 *)
%o A174090 (Python)
%o A174090 from sympy import primepi
%o A174090 def A174090(n):
%o A174090     def bisection(f,kmin=0,kmax=1):
%o A174090         while f(kmax) > kmax: kmax <<= 1
%o A174090         while kmax-kmin > 1:
%o A174090             kmid = kmax+kmin>>1
%o A174090             if f(kmid) <= kmid:
%o A174090                 kmax = kmid
%o A174090             else:
%o A174090                 kmin = kmid
%o A174090         return kmax
%o A174090     def f(x): return int(n+x+(0 if x<=1 else 1-primepi(x))-x.bit_length())
%o A174090     return bisection(f,n,n) # _Chai Wah Wu_, Sep 19 2024
%o A174090 (PARI) list(lim)=Set(concat(concat(1,primes(lim)), vector(logint(lim\2,2),i,2^(i+1)))) \\ _Charles R Greathouse IV_, Sep 19 2024
%o A174090 (PARI) select( {is_A174090(n)=isprime(n)||n==1<<exponent(n+!n)}, [0..299]) \\ _M. F. Hasler_, Oct 24 2024
%Y A174090 Numbers not in A111774.
%Y A174090 Equals A000079 UNION A065091.
%Y A174090 Equals A067133 \ {6}.
%Y A174090 Cf. A000040, A000203, A000396, A000668, A006005, A019434, A092506.
%Y A174090 Cf. also A138591, A174069, A174070, A174071.
%K A174090 nonn,easy
%O A174090 1,2
%A A174090 _Vladimir Joseph Stephan Orlovsky_, Mar 07 2010, and _Omar E. Pol_, Feb 24 2014
%E A174090 This entry is the result of merging an old incorrect entry and a more recent correct version. _N. J. A. Sloane_, Dec 07 2015