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.

User: Bill McEachen

Bill McEachen's wiki page.

Bill McEachen has authored 61 sequences. Here are the ten most recent ones:

A379757 a(n) = a(n-1) + 1 with two exceptions: if a(n-1) is prime, a(n) = a(n-2) + a(n-1), or if a(n-1) is a power, a(n) = a(n-1) / (root factor), with initial three terms are 0, 1, 2.

Original entry on oeis.org

0, 1, 2, 3, 5, 8, 4, 2, 6, 7, 13, 20, 21, 22, 23, 45, 46, 47, 93, 94, 95, 96, 97, 193, 290, 291, 292, 293, 585, 586, 587, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 4741, 4742, 4743
Offset: 1

Author

Bill McEachen, Jan 02 2025

Keywords

Comments

The construction rules are very basic, but lead to somewhat surprising results. Terms that are perfect powers are extremely rare (only n=6,7 so far). Additionally, the sequence is nearly all composites. Comparing to A000045, eight early distinct terms are in common, but it is unclear when another intersection is seen.

Examples

			We know a(1)=0, a(2)=1, a(3)=2. Since a(3) is prime, a(4)=a(2)+a(3)=3. Since a(4) is prime, a(5)=a(3)+a(4)=5. Similarly, a(6)=a(4)+a(5)=8. Since a(6) is a perfect power, a(7) = a(6)/2 since 8=2^3. Since a(7)=4 is another perfect power, a(8)=4/2=2. Since a(8) is prime, a(9)=a(7)+a(8)=6. For clarity, if a(n-1) = r^k, then a(n) = a(n-1)/r.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = If[n < 4, n-1, If[PrimeQ[a[n-1]], a[n-1] + a[n-2], If[(g = GCD @@ FactorInteger[a[n-1]][[;; , 2]]) > 1, a[n-1]^(1 - 1/g), a[n-1] + 1]]]; Array[a, 54] (* Amiram Eldar, Apr 10 2025 *)

Formula

Conjecture: log(a(n)) ~ k*sqrt(n).

A381329 Number of steps for n to reach 1 under the map x -> x/2 if x is even, x -> 2*x+1 if x is prime or a perfect power, otherwise x -> gpf(x)-1 where gpf(x) = A006530(x).

Original entry on oeis.org

0, 1, 5, 2, 16, 6, 4, 3, 10, 17, 15, 7, 20, 5, 3, 4, 8, 11, 9, 18, 7, 16, 14, 8, 6, 21, 19, 6, 7, 4, 8, 5, 18, 9, 7, 12, 4, 10, 8, 19, 23, 8, 8, 17, 3, 15, 13, 9, 19, 7, 5, 22, 11, 20, 18, 7, 12, 8, 6, 5, 21, 9, 7, 6, 8, 19, 4, 10, 17, 8, 9, 13, 8, 5, 3, 11, 18
Offset: 1

Author

Bill McEachen, Feb 20 2025

Keywords

Comments

Does every n reach 1?

Examples

			n=7 reaches 1 by 7 -> 15 -> 4 -> 2 -> 1 which is a(7)=4 steps.
Starting from 47993 yields 4362, 2181, 726, 363, 10, 5, 11, 23, 47, 95, 18, 9, 19, 39, 12, 6, 3, 7, 15, 4, 2, 1. Thus a(47993)=22.
		

Crossrefs

Cf. A006530.

Programs

  • Mathematica
    s[n_] := Which[n == 1, 1, EvenQ[n], n/2, PrimeQ[n] || GCD @@ ((f = FactorInteger[n])[[;; , 2]]) > 1, 2*n + 1, True, f[[-1, 1]] - 1]; a[n_] := -1 + Length@ NestWhileList[s, n, # > 1 &]; Array[a, 100] (* Amiram Eldar, Feb 20 2025 *)

A377371 a(n) = k*(a(n-1)+n), k=-1 for prime n, otherwise k=1 (a(1)=1).

Original entry on oeis.org

1, -3, 0, 4, -9, -3, -4, 4, 13, 23, -34, -22, 9, 23, 38, 54, -71, -53, 34, 54, 75, 97, -120, -96, -71, -45, -18, 10, -39, -9, -22, 10, 43, 77, 112, 148, -185, -147, -108, -68, 27, 69, -112, -68, -23, 23, -70, -22, 27, 77, 128, 180, -233, -179, -124, -68, -11
Offset: 1

Author

Bill McEachen, Dec 27 2024

Keywords

Comments

From the infinitude of the primes, k<0 will always be seen, and the +/- halves of the graph are essentially mirror images. The number of sign changes through n should be on the order of primepi(n).

Examples

			a(1)=1. For n=2 (prime), a(2) = -(1+2) = -3. For n=3 (prime), a(3) = -(-3+3) = 0.
		

Programs

  • Mathematica
    j = 1; {j}~Join~Reap[Do[k = (1 - 2 Boole[PrimeQ[n]])*(j + n); j = Sow[k], {n, 2, 57}] ][[-1, 1]] (* Michael De Vlieger, Dec 28 2024 *)

Formula

a(n) = a(n-1) + n for composite n, else -(a(n-1) + n).

A378814 a(n) = round(n/(A000005(A071904(n))-2)).

Original entry on oeis.org

1, 1, 2, 4, 3, 3, 4, 4, 2, 10, 6, 6, 7, 4, 8, 8, 4, 9, 6, 10, 11, 11, 12, 12, 6, 4, 14, 14, 7, 15, 31, 16, 17, 17, 18, 6, 19, 19, 20, 10, 10, 21, 22, 22, 8, 46, 12, 12, 25, 25, 26, 26, 9, 9, 28, 28, 29, 15, 30, 30, 31, 31, 32, 32, 9, 11, 34, 34, 17, 18, 36
Offset: 1

Author

Bill McEachen, Dec 08 2024

Keywords

Comments

Nearly all of the data falls on lines discussed below. There are a few "outliers" visible on the graph. There are <120 such outliers in the first 20000 terms (about 0.6%). Many of the outlier indices belong to A037040. The lines are n, (n+0)/2, (n+2)/4, (n+4)/6, (n+6)/8,....

Examples

			Let n=14, A071904(n)=63, tau(63)=6 so a(14)=round(14/(6-2))=4.
		

Crossrefs

Programs

  • Mathematica
    MapIndexed[Floor[#2[[1]]/# + 1/2] &, DivisorSigma[0, Select[Range[9, 500, 2], CompositeQ]] - 2] (* Paolo Xausa, Dec 16 2024 *)

A378677 a(n)=a(n-1) + prime(n) for n prime, and a(n)=-a(n-1) otherwise, with a(0)=0, with duplicates removed afterwards.

Original entry on oeis.org

0, 3, 8, -8, -3, 14, -14, 17, -17, 24, -24, 35, -35, 32, -32, 51, -51, 58, -58, 69, -69, 88, -88, 91, -91, 100, -100, 111, -111, 130, -130, 147, -147, 136, -136, 195, -195, 158, -158, 209, -209, 192, -192, 239, -239, 222, -222, 287, -287, 260, -260, 303, -303
Offset: 0

Author

Bill McEachen, Dec 03 2024

Keywords

Comments

Let b = subset of positive terms for n>4. We have A073131= b(m+2)-b(m) , A006450= b(m+2)+b(m) and A299644= b(m+2)+2*b(m+1)+b(m).

Examples

			n=1 is not prime, so a(1)= -a(0)= 0. n=2 is prime, so a(2)=a(1)+prime(2)=0+3=3. n=5 is prime, so a(5)=3, but note that it duplicates a(2). n=6 is not prime, so a(6)= -a(5)=-3. After terms are computed, duplicates are only then removed, which will alter indices accordingly.
		

Crossrefs

Programs

  • Mathematica
    Module[{n = 0}, DeleteDuplicates[NestList[If[PrimeQ[++n], # + Prime[n], -#] &, 0, 200]]] (* Paolo Xausa, Dec 06 2024 *)

Formula

a(n) = a(n-1) + a prime for n odd >4.
a(n) = -a(n-1) for a(n-1)>0, n>1.

A378500 a(1) = 2, then a(n) = a(n-1) - 2 for n even, a(n) = a(n-1) + 3 for n an odd prime or odd prime power, and a(n) = a(n-1) + 2 otherwise.

Original entry on oeis.org

2, 0, 3, 1, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 8, 6, 9, 7, 10, 8, 10, 8, 11, 9, 12, 10, 13, 11, 14, 12, 15, 13, 15, 13, 15, 13, 16, 14, 16, 14, 17, 15, 18, 16, 18, 16, 19, 17, 20, 18, 20, 18, 21, 19, 21, 19, 21, 19, 22, 20, 23, 21, 23, 21, 23, 21, 24, 22, 24, 22, 25
Offset: 1

Author

Bill McEachen, Nov 30 2024

Keywords

Comments

Asymptotically the sequence should reach long periods of stasis, with rare increases with each new prime so as to yield a strict permutation of the positive integers if duplicates are removed.

Examples

			3 is prime so a(3) = a(2) + 3 = 0 + 3 = 3. 4 is even so a(4) = a(3) - 2 = 3 - 2 = 1.
		

Programs

  • Mathematica
    Module[{n = 1}, NestList[# + Which[EvenQ[++n], -2, PrimePowerQ[n], 3, True, 2] &, 2, 100]] (* Paolo Xausa, Dec 06 2024 *)
  • PARI
    first(n)=my(v=vector(n)); v[1]=2; for(k=2,n, v[k]=v[k-1]+if(k%2==0, -2, isprimepower(k), 3, 2)); v \\ Charles R Greathouse IV, Dec 01 2024

Formula

a(n) = a(n-1) - 2 for n even.
a(n) = a(n-1) + 3 for n an odd prime or odd prime power.
a(n) = a(n-1) + 2 for n an odd composite not a prime power.
a(n) ~ n/log n. - Charles R Greathouse IV, Dec 01 2024

Extensions

Corrected by Charles R Greathouse IV, Dec 01 2024

A375205 PrimePi(greatest prime < sqrt(Q)) - PrimePi(greatest prime factor(Q) < sqrt(Q)), with Q = A082686(n).

Original entry on oeis.org

0, 0, 1, 1, 0, 1, 0, 2, 1, 2, 0, 1, 2, 1, 0, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 3, 2, 3, 1, 2, 3, 0, 2, 1, 3, 2, 3, 1, 0, 4, 2, 4, 4, 3, 1, 2, 0, 4, 2, 3, 4, 1, 4, 3, 2, 4, 0, 1, 3, 4, 4, 2, 0, 4, 1, 3, 2, 4, 3, 4, 0, 1, 4, 3, 2, 5, 4, 2, 1, 3, 5, 4, 5, 3
Offset: 1

Author

Bill McEachen, Oct 15 2024

Keywords

Comments

New records appear to be in consecutive numerical order, suggesting every integer should be seen in this infinite sequence. Considering a(n)=0, empirically a power fit Y=k*x^c correlates well with the "x-th" occurrence. For example, the 491st 0 value is at n=99808.

Examples

			A082686(8)=51, with square root = 7.14... so the greatest prime < 7.14 is 7, while the greatest prime factor of 51 < 7.14 is 3. The prime count from 3 to 7 is 2, so a(8)=2.
A082686(999)=2883 with square root = 53.69... so the greatest prime < 53.69 is 53, while the greatest prime factor of 2883 < 53.69 is 31. The prime count from 31 to 53 is 5, so a(999)=5.
		

Crossrefs

Cf. A082686.

Programs

  • Mathematica
    nmax=85;q={};m=15;Until[Length[q]==nmax,If[ !PrimeQ[m]&&EvenQ[DivisorSigma[0, m]],AppendTo[q,m]];m=m+2];Table[PrimePi[NextPrime[Sqrt[q[[n]]],-1]]-PrimePi[Select[First/@FactorInteger[q[[n]]],#James C. McMahon, Dec 06 2024 *)

A375235 Records of A112591.

Original entry on oeis.org

1, 6, 12, 28, 58, 126, 252, 506, 1012, 2042, 4082, 8190, 16366, 32742, 65518, 131056, 262114, 524280, 1048554, 2097146, 4194278, 8388594, 16777208, 33554390, 67108858, 134217716, 268435396, 536870852, 1073741814, 2147483614, 4294967284, 8589934580, 17179869158
Offset: 1

Author

Bill McEachen, Aug 06 2024

Keywords

Comments

Sequence closely parallel to A000295.

Examples

			The first term of A112591 = 1 is a record and is a(1). The next A112591 value > 1 is 6 which is a(2).
		

Crossrefs

Cf. A000295, A014210 (primes where records occur), A014234, A112591.

Programs

  • Mathematica
    a[n_] := BitXor @@ NextPrime[2^n, {-1, 1}]; a[1] = 1; Array[a, 33] (* Amiram Eldar, Aug 08 2024 *)
  • PARI
    a(n)= if(n==1,1,bitxor(precprime(2^n), nextprime(2^n) ))

Formula

a(n) = previous_prime(2^n) XOR next_prime(2^n) = A112591(A014234(n)) for n > 1.

Extensions

More terms from Amiram Eldar, Aug 06 2024

A375010 a(n) = prime(n-1) - floor((prime(n-2) + prime(n-1) + prime(n)) / 3).

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 0, 0, 2, -1, 1, 1, 0, 0, 0, 2, -1, 1, 1, -1, 1, 0, 0, 2, 1, 0, 1, 0, -3, 4, 0, 2, -2, 3, -1, 0, 1, 0, 0, 2, -2, 3, 0, 1, -3, 0, 3, 1, 0, 0, 2, -2, 2, 0, 0, 2, -1, 1, 1, -2, -1, 4, 1, 0, -3, 3, -1, 3, 0, 0, 0, 1, 0, 1, 0, 0, 2, -1, 0, 3, -2
Offset: 3

Author

Bill McEachen, Jul 27 2024

Keywords

Examples

			For n=500001 a(n) = 7368787 - floor((7368743 + 7368787 + 7368791)/3) = 14.
		

Programs

  • Mathematica
    seq[len_] := (#[[2]] - Floor[Total[#]/3]) & /@ Partition[Prime[Range[len]], 3, 1]; seq[100] (* Amiram Eldar, Jul 27 2024 *)

A374965 a(n) = 2*a(n-1) + 1 for a(n-1) not prime, otherwise a(n) = prime(n) - 1; with a(1)=1.

Original entry on oeis.org

1, 3, 4, 9, 19, 12, 25, 51, 103, 28, 57, 115, 231, 463, 46, 93, 187, 375, 751, 70, 141, 283, 82, 165, 331, 100, 201, 403, 807, 1615, 3231, 6463, 12927, 25855, 51711, 103423, 156, 313, 166, 333, 667, 1335, 2671, 192, 385, 771, 1543, 222, 445, 891, 1783, 238, 477
Offset: 1

Author

Bill McEachen, Jul 25 2024

Keywords

Comments

Sequence is clearly infinite and not monotonic. Primes are sparse.
When is the next prime after n=10016 ? [Answer from N. J. A. Sloane, Aug 01 2024: The point of Bill's question is that a(10016) is the prime 838951, which is in fact the 289th prime in this sequence, as can be seen from A375028 and A373799. Thanks to the work of Lucas A. Brown (see A050412), we now know that the answer to Bill's question is that the 290th prime is the 102410-digit prime 104917*2^340181 - 1 = 5079...8783, which is a(350198). It was a very good question!]
It appears that the trajectories for different initial conditions a(1) converge to a few attractors. For all prime values and most nonprime values of a(1), the trajectories converge to the same attractor with prime 838951 at n=10016. For a(1) = 147, 295, 591, 1183, ... the trajectories converge to prime 85796863 at n=4390. For a(1) = 658, the trajectory reaches a prime with 240983 digits after 800516 steps. For a(1) = 509202, the trajectory never reaches a prime (see A050412, A052333). - Chai Wah Wu, Jul 29 2024

Examples

			a(1) = 1 is not a prime, so a(2) = 2*1+1 = 3. a(2) is a prime, so a(3) = prime(3)-1 = 4. a(4) = 2*4+1 = 9.
		

Crossrefs

The primes are listed in A375028 (see also A373798 and A373804).
Cf. A050412 and A052333.

Programs

  • Mathematica
    a[n_] := a[n] = If[!PrimeQ[a[n-1]], 2*a[n-1] + 1, Prime[n]-1]; a[1] = 1; Array[a, 60] (* Amiram Eldar, Jul 25 2024 *)
    nxt[{n_,a_}]:={n+1,If[!PrimeQ[a],2a+1,Prime[n+1]-1]}; NestList[nxt,{1,1},60][[;;,2]] (* Harvey P. Dale, Jul 28 2024 *)
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def A374965_gen(): # generator of terms
        a, p = 1, 3
        while True:
            yield a
            a, p = p-1 if isprime(a) else (a<<1)+1, nextprime(p)
    A374965_list = list(islice(A374965_gen(),30)) # Chai Wah Wu, Jul 29 2024