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: Cody M. Haderlie

Cody M. Haderlie's wiki page.

Cody M. Haderlie has authored 12 sequences. Here are the ten most recent ones:

A277495 a(1) = 1; a(n) = n if a(n-1) = 1; otherwise, a(n) = digit sum (n written in base a(n-1)).

Original entry on oeis.org

1, 2, 2, 1, 5, 2, 3, 4, 3, 2, 3, 2, 3, 4, 6, 6, 7, 6, 4, 2, 3, 4, 5, 8, 4, 5, 3, 2, 4, 6, 6, 7, 9, 10, 8, 8, 9, 6, 4, 4, 5, 6, 3, 6, 5, 6, 7, 12, 5, 2, 4, 4, 5, 6, 5, 4, 6, 8, 10, 6, 6, 7, 3, 4, 2, 2, 3, 6, 9, 14, 6, 2, 3
Offset: 1

Author

Cody M. Haderlie, Oct 17 2016

Keywords

Examples

			a(15-1) = 4; 15 in base 4 is 33; 3+3 = 6, so a(15) = 6.
		

Programs

  • Mathematica
    $RecursionLimit=100
    a[1]=1;
    a[n_]:=If[a[n-1]!=1,Total[IntegerDigits[n,a[n-1]]],n]
    Array[a,100]
  • PARI
    lista(nn) = {print1(a = 1, ", "); for (n=2, nn, if (a==1, a = n, a = vecsum(digits(n, a));); print1(a, ", "););} \\ Michel Marcus, Oct 21 2016

A272903 Least nonnegative integer x such that n^2+nx-2n-x is prime.

Original entry on oeis.org

2, 0, 1, 1, 1, 1, 5, 1, 1, 1, 1, 2, 1, 2, 1, 1, 5, 2, 1, 1, 1, 4, 5, 1, 17, 1, 3, 1, 13, 1, 1, 2, 3, 2, 1, 2, 5, 1, 1, 4, 1, 2, 5, 1, 1, 1, 13, 1, 11, 1, 3, 5, 1, 1, 1, 1, 5, 7, 1, 1, 11, 2, 3, 1, 1, 1, 7, 1, 3, 1, 11, 3, 5, 2, 3, 1, 17, 3, 7, 4, 3, 7, 1, 3, 1, 1, 3, 2, 1, 3, 11, 2, 1, 1, 7, 1, 17, 5, 9
Offset: 2

Author

Cody M. Haderlie, May 09 2016

Keywords

Comments

The offset is 2 because n^2+nx-2n-x = -1 for n = 1 and all x.
a(n) seems to be exclusively prime or a product of two previous terms, and less than n excluding n = 2. x is most frequently equal to 1.

Programs

  • Mathematica
    Table[Min[DeleteCases[Table[If[PrimeQ[n^2+n*x-2n-x],x],{x,0,n}],Null]],{n,2,100}] (*Assuming that xHarvey P. Dale, May 12 2019 *)

A272181 a(1) = 1; a(n) = n mod a(k), k being the largest value such that n mod a(k) > 1, or n if there is no such k.

Original entry on oeis.org

1, 2, 3, 2, 2, 6, 7, 2, 2, 3, 2, 5, 3, 2, 3, 2, 2, 3, 4, 2, 3, 2, 2, 4, 4, 2, 3, 3, 2, 2, 3, 2, 3, 2, 2, 36, 2, 2, 3, 4, 2, 2, 3, 2, 9, 2, 2, 3, 4, 2, 3, 7, 4, 2, 3, 2, 3, 2, 2, 4, 5, 2, 3, 4, 2, 2, 3, 2, 4, 2, 3, 2, 3, 2
Offset: 1

Author

Cody M. Haderlie, Apr 21 2016

Keywords

Examples

			a(5) = 2; k = 3 and 5 mod a(3) = 2.
		

A271720 a(1)=1; for n>1, define a sequence {b(m), m >= 1} by b(1)=n b(2)=13, and b(m) = A020639(b(m-2)) + A006530(b(m-1)); then a(n) is the number of terms in that sequence before the first of the infinite string of 4s.

Original entry on oeis.org

8, 13, 15, 13, 4, 13, 12, 13, 15, 13, 4, 13, 16, 13, 15, 13, 12, 13, 15, 13, 15, 13, 4, 13, 4, 13, 15, 13, 8, 13, 12, 13, 15, 13, 4, 13, 12, 13, 15, 13, 4, 13, 8, 13, 15, 13, 12, 13, 12, 13, 15, 13, 12, 13, 4, 13, 15, 13, 4, 13, 8, 13, 15, 13, 4, 13, 12, 13, 15, 13, 8, 13, 11, 13, 15, 13, 12, 13
Offset: 1

Author

Cody M. Haderlie, Apr 12 2016

Keywords

Comments

Note that the majority of the terms (every other term, initially) are equal to b(2), which is 13. This happens with several other values of b(2) less than 20. Many other values for b(2) have been tested, and it seems that for all b(2) < 100000000, a(n) < 20.
Records 8, 13, 15, 16, 19, 20, 24, ... occur at 1, 2, 3, 13, 349, 3919, 55633, ...

Examples

			n = 6; the sequence is:
6, 13, 15, 18, 6, 5, 7, 12, 10, 7, 9, 10, 8, 4, 4, 4, ...
There are 13 terms before the first of the infinite 4s; a(6) = 13.
For n = 55633 the sequence is: 55633, 13, 55646, 27836, 6961, 6963, 7172, 166, 85, 19, 24, 22, 13, 15, 18, 6, 5, 7, 12, 10, 7, 9, 10, 8, 4, 4, 4, ... . As the first 4 comes as the 25th term, a(55633) = 24. - _Antti Karttunen_, Oct 01 2018
		

Programs

  • Mathematica
    Table[
    Clear[h];
    h[1]=x;
    h[2]=13;
    h[n_]:=FactorInteger[h[n-1]][[-1,1]]+FactorInteger[h[n-2]][[1,1]];
    Position[Array[h,100],4][[1,1]]-1,
    {x,1,100}] (*This only works for x≠4*)
  • PARI
    A006530(n) = if(n>1, vecmax(factor(n)[, 1]), 1); \\ From A006530
    A020639(n) = if(1==n, n, factor(n)[1, 1]);
    A271720(n) = { my(up=1001, bvec = vector(up), m=1); bvec[1] = n; bvec[2] = 13; for(n=3,oo,bvec[n] = A020639(bvec[n-2])+A006530(bvec[n-1]); if(4==bvec[n], return(n-1))); }; \\ Antti Karttunen, Oct 01 2018

A269026 a(1)=1; for n>1, define a sequence {b(m), m >= 1} by b(1)=a(n-1), b(2)=n, and b(m) = A020639(b(m-2)) + A006530(b(m-1)); then a(n) is the number of terms in that sequence before the first of the infinite string of 4s.

Original entry on oeis.org

1, 9, 12, 1, 4, 10, 5, 6, 8, 6, 5, 3, 15, 7, 12, 2, 17, 7, 4, 6, 13, 11, 8, 10, 9, 3, 12, 9, 11, 3, 12, 2, 16, 6, 12, 10, 5, 11, 12, 6, 9, 7, 12, 14, 13, 11, 16, 10, 5, 7, 12, 14, 8, 10, 5, 11, 4, 10, 17, 15, 15, 7, 8, 2, 5, 3, 15, 7, 4, 9, 12, 10, 5, 10, 13, 3, 11, 11, 11
Offset: 1

Author

Cody M. Haderlie, Apr 11 2016

Keywords

Examples

			n = 3:
a(n-1) = a(2) = 9;
b(1) = 9, b(2) = 3;
the sequence generated is: 9, 3, 6, 6, 5, 7, 12, 10, 7, 9, 10, 8, 4, 4, 4, ...
There are 12 terms before the first of the infinite 4s, so a(3) = 12.
		

Crossrefs

Programs

  • PARI
    spf(n) = if (n==1, 1, vecmin(factor(n)[,1]));
    gpf(n) = if (n==1, 1, vecmax(factor(n)[,1]));
    nbt(a, n) = {x = a; y = n; nb = 0; while (!((x==4) && (y==4)), z = spf(x) + gpf(y); x = y; y = z; nb++;); nb;}
    lista(nn) = { print1(a=1, ", "); for (n=2, nn, na = nbt(a, n); print1(na, ", "); a = na;);} \\ Michel Marcus, Apr 12 2016

A271621 a(1) = 2, a(2) = 3, a(n) = A020639(a(n-2)) + A006530(a(n-1)).

Original entry on oeis.org

2, 3, 5, 8, 7, 9, 10, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
Offset: 1

Author

Cody M. Haderlie, Apr 10 2016

Keywords

Comments

Any sequence generated by this formula and any values for a(1) and a(2) will have a finite number of terms not equal to 4; i.e., all such sequences will eventually end up at 4 (and all following terms will be 4; 4 is the only term that can appear more than twice in a row in a sequence because it is the only number equal to the sum of its least and greatest prime factors). Example: a(1) = 77713; a(2) = 16; the sequence is: 77713, 16, 77715, 159, 56, 10, 7, 9, 10, 8, 4, 4, 4, ...

Examples

			a(1) = 13; a(2) = 46.
lpf(13) = 13; gpf(46) = 23.
a(3) = 13 + 23 = 36.
		

Crossrefs

Programs

  • Mathematica
    a[1] = 2; a[2] = 3; a[n_] := a[n] = FactorInteger[a[n - 2]][[1, 1]] +
    FactorInteger[a[n - 1]][[-1, 1]]; Array[a, {120}] (* Michael De Vlieger, Apr 12 2016 *)
  • PARI
    spf(n) = if (n==1, 1, vecmin(factor(n)[,1]));
    gpf(n) = if (n==1, 1, vecmax(factor(n)[,1]));
    lista(nn) = {print1(x=2, ", "); print1(y=3, ", "); for (n=1, nn, ny = spf(x) + gpf(y); print1(ny, ", "); x = y; y = ny;);} \\ Michel Marcus, Apr 15 2016

Formula

a(n) = lpf(a(n-2)) + gpf(a(n-1)), where lpf(n) is the least prime dividing n and gpf(n) is the greatest prime dividing n.

A267822 First differences of A271063.

Original entry on oeis.org

1, 2, 2, 3, 7, 5, 3, 25, 22, 17, 72, 161, 89, 72, 50, 25, 22, 17, 10, 7, 5, 3, 2, 5, 624, 622, 619, 614, 607, 597, 580, 558, 533, 483, 411, 6466, 5983, 5450, 4892, 4312, 3715, 3108, 2494, 43297, 40803, 37695, 33980
Offset: 1

Author

Cody M. Haderlie, Apr 09 2016

Keywords

Crossrefs

Cf. A271063.

Formula

a(n) = A271063(n + 1) - A271063(n).

A271441 a(1) = 2; if gpf(a(n-1)) <= n-1 then a(n) = a(n-1) + a(gpf(a(n-1))), else a(n) = a(n-1) + 1, where gpf(m) is the greatest prime factor of m.

Original entry on oeis.org

2, 3, 4, 7, 8, 11, 12, 16, 19, 20, 28, 40, 48, 52, 100, 108, 112, 124, 125, 133, 258, 259, 260, 308, 336, 348, 349, 350, 362, 363, 391, 651, 1042, 1043, 1044, 1406, 1407, 1408, 1436, 1437, 1438, 1439, 1440, 1448, 1449, 1709, 1710, 1835, 1836, 1948
Offset: 1

Author

Cody M. Haderlie, Apr 07 2016

Keywords

Comments

Choosing the initial value a(1) = 2 seems to produce the most irregular sequence.

Examples

			Since a(11) = 28, gpf(28) = 7 and a(7) = 12, then a(12) = 28 + 12 = 40.
		

Crossrefs

Cf. A006530 (gpf).

Programs

  • Mathematica
    Nest[Append[#, (x = #[[-1]]) + If[(p = FactorInteger[x][[-1, 1]]) <= Length@#, #[[p]], 1]] &, {2}, 49] (* Ivan Neretin, Jan 27 2017 *)
  • PARI
    gpf(n) = if (n==1, 1, vecmax(factor(n)[,1]));
    lista(nn) = {va = vector(nn); print1(va[1] = 2, ", "); for (n=2, nn, if (gpf(va[n-1]) <= n-1, va[n] = va[n-1] + va[gpf(va[n-1])], va[n] = va[n-1]+1); print1(va[n], ", "););} \\ Michel Marcus, Apr 09 2016

A271418 Define a sequence by b(1) = n, b(m) = b(m-1) + b(m-1)/A052126(m) + 1; then a(n) is the least m such that b(m) belongs to A270807.

Original entry on oeis.org

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

Author

Cody M. Haderlie, Apr 06 2016

Keywords

Examples

			the sequence where b(1) = 2 is 2, 4, 7, 9, 13, 15, ...
7 is shared with A270807
there are 3 terms in 2, 4, 7; a(2) = 3
		

Crossrefs

Programs

  • Mathematica
    f[n_] := n + n/FactorInteger[n][[-1, 1]] + 1; s = NestList[f, 1, 10^2]; Table[Length@ NestWhileList[f, n, ! MemberQ[s, #] &], {n, 120}] (* Michael De Vlieger, Apr 08 2016 *)

Extensions

a(75) corrected by Chai Wah Wu, Apr 06 2016

A271063 a(1) = 2, a(2) = 3; thereafter a(n) = a(n-1) + a(|n-a(T)|), where a(T) is the largest term in the sequence before a(n) such that 0 < |n-a(T)| < n.

Original entry on oeis.org

2, 3, 5, 7, 10, 17, 22, 25, 50, 72, 89, 161, 322, 411, 483, 533, 558, 580, 597, 607, 614, 619, 622, 624, 629, 1253, 1875, 2494, 3108, 3715, 4312, 4892, 5450, 5983, 6466, 6877, 13343, 19326, 24776, 29668, 33980, 37695, 40803, 43297, 86594, 127397, 165092, 199072, 228740, 253516
Offset: 1

Author

Cody M. Haderlie, Apr 05 2016

Keywords

Comments

When a(1) = 1, the formula generates the natural numbers.

Examples

			a(11) = 89
a(T) = a(7) = 22
|12-22| = 10
a(10) = 72
89 + 72 = 161
a(12) = 161
		

Programs

  • Mathematica
    a = {2, 3}; Do[AppendTo[a, a[[n - 1]] + Part[a, #] &@ SelectFirst[ Reverse@ Abs[a - n], 0 < # < n &]], {n, 3, 50}]; a (* Michael De Vlieger, Apr 08 2016 *)
  • PARI
    lista(nn) = {va = vector(nn); print1(va[1] = 2, ", "); print1(va[2] = 3, ", "); for (n=3, nn, T = 0; forstep(k = n-1, 1, -1, vabs = abs(n - va[k]); if ((vabs < n) && (vabs > 0), T = k; break);); va[n] = va[n-1] + va[abs(n-va[T])]; print1(va[n], ", "););} \\ Michel Marcus, Apr 08 2016