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: Nathaniel J. Strout

Nathaniel J. Strout's wiki page.

Nathaniel J. Strout has authored 5 sequences.

A327439 a(0)=1. If a(n-1) and n are relatively prime and a(n-1)!=1, a(n) = a(n-1) - 1. Otherwise (i.e., if a(n-1) and n share a common factor or a(n-1)=1), a(n) = a(n-1) + gcd(a(n-1),n) + 1.

Original entry on oeis.org

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

Author

Nathaniel J. Strout, Feb 24 2020

Keywords

Comments

Graphically at large scales this sequence is vaguely self-similar, though in certain sections it acts in a rough manner, in particular in regions surrounding apparent cusps. See the program for a graph to zoom in on these sections.
See Python program for zoomable graph.

Programs

  • Mathematica
    a[0] = 1; a[n_] := a[n] = If[a[n - 1] != 1 && CoprimeQ[n, a[n - 1]], a[n - 1] - 1, a[n - 1] + GCD[a[n - 1], n] + 1]; Array[a, 101, 0] (* Amiram Eldar, Feb 24 2020 *)
    nxt[{n_,a_}]:={n+1,If[CoprimeQ[n+1,a]&&a!=1,a-1,a+GCD[a,n+1]+1]}; NestList[nxt,{0,1},70][[;;,2]] (* Harvey P. Dale, Jun 08 2024 *)
  • Python
    import math
    import matplotlib.pyplot as plt
    num = 10000
    x = []
    y = []
    # y is the main sequence
    def sequence():
        a = 1
        y.append(a)
        for i in range(num):
            if (a != 1) and (math.gcd(a,i+1) == 1):
                a -= 1
            else:
                a += math.gcd(a,i+1)+1
            x.append(i)
            y.append(a)
        x.append(num)
    sequence()
    # code only regarding the plot.
    plt.xlim(0,num)
    plt.ylim(0,num)
    plt.plot(x, y)
    plt.xlabel('x - axis')
    plt.ylabel('y - axis')
    plt.title('Plot of Sequence')
    plt.show()

A330190 Symmetric matrix read by antidiagonals: f(i,j) = 1 + gcd(f(i-1,j), f(i,j-1)), where f(1,j) and f(i,1) are 1.

Original entry on oeis.org

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

Author

Nathaniel J. Strout, Dec 04 2019

Keywords

Comments

This matrix when displayed in a gray scale, from least to greatest, forms spikes of increasing numbers because large sections of the antidiagonals are the same number. See examples section.

Examples

			An example of a triangle described in the comment:
  ...........
  ...........
  ..........2
  ........2 3
  ......2 3 4
  ....2 3 4 5
Array begins:
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...
  1, 2, 3, 2, 3, 2, 3, 2, 3, 2, ...
  1, 2, 2, 3, 4, 3, 4, 3, 4, 3, ...
  1, 2, 3, 4, 5, 2, 3, 4, 5, 2, ...
  1, 2, 2, 3, 2, 3, 4, 5, 6, 3, ...
  1, 2, 3, 4, 3, 4, 5, 6, 7, 2, ...
  1, 2, 2, 3, 4, 5, 6, 7, 8, 3, ...
  1, 2, 3, 4, 5, 6, 7, 8, 9, 4, ...
  1, 2, 2, 3, 2, 3, 2, 3, 4, 5, ...
  ...
		

Programs

  • Mathematica
    f[1, j_] := f[1, j] = 1; f[i_, 1] := f[i, 1] = 1; f[i_, j_] := f[i, j] = 1 + GCD[f[i - 1, j], f[i, j - 1]]; Table[f[m - k + 1, k], {m, 13}, {k, m, 1, -1}] // Flatten (* Michael De Vlieger, Aug 03 2022 *)
  • PARI
    T(n)={my(M=matrix(n,n,i,j,1)); for(i=2, n, for(j=2, n, M[i,j] = 1 + gcd(M[i-1,j], M[i,j-1]))); M}
    { my(A=T(10)); for(i=1, #A, print(A[i,])) } \\ Andrew Howroyd, Jan 25 2020

A321297 a(n) is the sum of proper divisors of n that are >= sqrt(n) minus the sum of the divisors that are greater than 1 and less than sqrt(n).

Original entry on oeis.org

0, 0, 0, 2, 0, 1, 0, 2, 3, 3, 0, 5, 0, 5, 2, 10, 0, 10, 0, 9, 4, 9, 0, 17, 5, 11, 6, 15, 0, 21, 0, 18, 8, 15, 2, 36, 0, 17, 10, 27, 0, 31, 0, 27, 16, 21, 0, 45, 7, 28, 14, 33, 0, 43, 6, 37, 16, 27, 0, 67, 0, 29, 20, 50, 8, 55, 0, 45, 20, 45, 0, 76, 0, 35, 32
Offset: 1

Author

Nathaniel J. Strout, Nov 02 2018

Keywords

Crossrefs

Cf. A000203 (sigma), A070038, A079667.

Programs

  • Mathematica
    Array[Function[{d, s}, 1 + Subtract @@ (Total /@ Reverse@ TakeDrop[d, LengthWhile[d, # < s &]])] @@ {Most@ Divisors[#], Sqrt@ #} &, 74, 2] (* Michael De Vlieger, Nov 25 2018 *)
  • PARI
    a(n)=sumdiv(n, d, if(d>1&&d=n/d, d, -d)))

Formula

a(p) = 0, for primes p.
a(n) = 2*A070038(n) - sigma(n) - n + 1 for n > 1. - Andrew Howroyd, Nov 25 2018

A304780 Consider a triangle whose first row is {1,2} and, for n > 1, has as its n-th row the integers k through 2k where k is the sum of the numbers in the (n-1)th row. Then a(n) is the first number in the n-th row.

Original entry on oeis.org

1, 3, 18, 513, 395523, 234658258578, 82596747478641253260993, 10233334041075645341729789249315281196742910563, 157081688394356396673208173772909833928515988895188885472258972148661958252271815996039831298
Offset: 1

Author

Nathaniel J. Strout, May 18 2018

Keywords

Examples

			Triangle begins:
  1, 2; (row sum = 3)
  3, 4, 5, 6; (row sum = 18)
  18, 19, 20, 21, ... 33, 34, 35, 36; (row sum = 513)
  513, 514, 515, 516, ..., 1023, 1024, 1025, 1026;
  ...
		

Crossrefs

Cf. A000217.

Programs

  • Mathematica
    RecurrenceTable[{a[1] == 1, a[n] == (3*a[n-1]*(a[n-1] + 1))/2}, a, {n, 1, 10}] (* Vaclav Kotesovec, Jul 23 2018 *)
    Nest[Append[#, Range[#, 2 #] &@ Total@ Last@ #] &, {{1, 2}}, 3] // Flatten (* Michael De Vlieger, Jul 26 2018 *)
  • PARI
    a(n) = if (n==1, 1, (3*a(n - 1)*(a(n - 1) + 1))/2); \\ Michel Marcus, May 24 2018

Formula

a(1) = 1, a(n) = (3*a(n-1)*(a(n-1) + 1))/2 for n > 1.
a(n) ~ (2/3) * c^(2^n), where c = 1.515006464529590220430714781603262955960312205695360166833... - Vaclav Kotesovec, Jul 23 2018

A296422 Primes that can be represented in the form b^n+1 or b^n-1 where b >= 2 and n >= 2.

Original entry on oeis.org

3, 5, 7, 17, 31, 37, 101, 127, 197, 257, 401, 577, 677, 1297, 1601, 2917, 3137, 4357, 5477, 7057, 8101, 8191, 8837, 12101, 13457, 14401, 15377, 15877, 16901, 17957, 21317, 22501, 24337, 25601, 28901, 30977, 32401, 33857, 41617, 42437, 44101, 50177, 52901
Offset: 1

Author

Nathaniel J. Strout, Dec 12 2017

Keywords

Comments

Union of A000668 and A121326. - Andrey Zabolotskiy, Dec 21 2017

Crossrefs

Cf. A000040 (primes), A001597 (perfect powers).
Cf. A000668 (Mersenne primes), A121326.

Programs

  • Maple
    N:= 10^5: # to get terms <= N
    R:= 3:
    for b from 2 while b^2+1 <= N do
      p:= 2:
      do
        p:= nextprime(p);
        if b^p-1 > N then break fi;
        if isprime(b^p-1) then R:= R, b^p-1 fi;
      od:
      p:= 1:
      do
        p:= 2*p;
        if b^p+1 > N then break fi;
        if isprime(b^p+1) then R:= R, b^p+1 fi;
      od;
    od:
    sort(convert({R},list)); # Robert Israel, Jan 08 2018
  • Mathematica
    Select[Prime@ Range[2, 10^4], AnyTrue[# + {-1, 1}, Or[# == 1, GCD @@ FactorInteger[#][[All, -1]] > 1] &] &] (* Michael De Vlieger, Dec 13 2017 *)
  • PARI
    lista(nn) = {forprime(p=2, nn, if ((p==2) || ispower(p+1) || ispower(p-1), print1(p, ", ")); ); } \\ Michel Marcus, Dec 13 2017