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.

Previous Showing 11-18 of 18 results.

A140482 a(n) = 2*n + tau(n).

Original entry on oeis.org

3, 6, 8, 11, 12, 16, 16, 20, 21, 24, 24, 30, 28, 32, 34, 37, 36, 42, 40, 46, 46, 48, 48, 56, 53, 56, 58, 62, 60, 68, 64, 70, 70, 72, 74, 81, 76, 80, 82, 88, 84, 92, 88, 94, 96, 96, 96, 106, 101, 106, 106, 110, 108, 116, 114, 120, 118, 120, 120, 132, 124, 128, 132, 135, 134, 140
Offset: 1

Views

Author

N. J. A. Sloane, Jun 29 2008

Keywords

Crossrefs

Cf. A000005 (tau), A140481, A062249.

Programs

  • Mathematica
    a[n_] := 2*n + DivisorSigma[0, n]; Array[a, 100] (* Amiram Eldar, Apr 07 2024 *)
  • PARI
    a(n) = 2*n + numdiv(n); \\ Amiram Eldar, Apr 07 2024

A285004 Numbers n that enter a cycle of greater length than that for any k < n in the iteration sequence s(0)=n, s(k+1) = s(k) + (-1)^k*d(s(k)), where d(n) is the number of divisors of n (A000005).

Original entry on oeis.org

3, 93, 273, 684, 3993, 58695, 91355, 167055, 441519, 2337513, 20225991, 20625997, 148789675, 470944675, 494359089, 3252701700, 3472027000, 9096968436
Offset: 1

Views

Author

Amiram Eldar, Apr 07 2017

Keywords

Comments

Claudia Spiro conjectured that for every initial number n the iteration sequence is eventually periodic.
The corresponding cycle lengths are: 2, 4, 6, 10, 12, 14, 16, 20, 22, 26, 28, 32, 34, 36, 44, 46, 52, 54.

Examples

			The sequence for 93 is 93, 93 + d(93) = 97, 97 - d(97) = 95, 95 + d(95) = 99, 99 - d(99) = 93, 93 + d(93) = 97, ... with a cycle of (93, 97, 95, 99) whose length is 4. All initial numbers < 93 end in a cycle whose length < 4, thus 93 is in the sequence.
		

Crossrefs

Cf. A000005, A049820, A062249, A175304 (numbers with cycle of length 2), A288070.

Programs

  • Mathematica
    lengths={}; Records={}; For[n=2, n<100, n++; c=1; v={}; m=0; s=1; a=n; i={}; While[m<10^6, AppendTo[v, a]; If[Length[v] > 3, i=LongestCommonSubsequencePositions[v[[1;; -3]], v[[-2;; -1]]], i = {}]; If[Length[i]==2 && Differences[i[[1]]][[1]]==1, c=Length[v]-i[[1]][[1]]-1; Break[]]; m++; a = a + s*DivisorSigma[0, a]; s = -s; ];  If[Length[lengths]==0 || c>lengths[[-1]], AppendTo[lengths, c]; AppendTo[Records, n]]]; Records

Extensions

a(11)-a(18) from Giovanni Resta, Apr 07 2017
Wrong term 1 removed by Amiram Eldar, Jun 05 2017

A288070 a(n) is the least number that enters a cycle of length 2n in the iteration sequence s(0)=n, s(k+1) = s(k) + (-1)^k*d(s(k)), where d(n) is the number of divisors of n (A000005).

Original entry on oeis.org

3, 93, 273, 1617, 684, 3993, 58695, 91355, 572793, 167055, 441519, 13991016, 2337513, 20225991, 48163788, 20625997, 148789675, 470944675, 626064036, 506112555, 963071088, 494359089, 3252701700, 3972446520, 4515893681, 3472027000, 9096968436
Offset: 1

Views

Author

Michel Marcus, Jun 05 2017

Keywords

Crossrefs

Cf. A000005, A049820, A062249, A175304 (numbers with cycle of length 2), A285004 (records of this sequence).

Programs

  • Mathematica
    nmax=10;lst=ConstantArray[0,nmax];For[n=2, n<10^6, n++; c=1; v={}; m=0; s=1; a=n; i={}; While[m<10^6, AppendTo[v, a]; If[Length[v] > 3, i=LongestCommonSubsequencePositions[v[[1;; -3]], v[[-2;; -1]]], i = {}];
    If[Length[i]==2 && Differences[i[[1]]][[1]]==1, c=Length[v]-i[[1]][[1]]-1; Break[]]; m++; a = a + s*DivisorSigma[0, a]; s = -s; ]; If[c/2Amiram Eldar, Jun 05 2017 *)
  • PARI
    findpos(v, new) = {for(i=1, #v, if (v[#v-i+1] == new, return (i)););}
    loop(n) = {my(k = 1, ok = 0, v = []); while(!ok, new = n + k*numdiv(n); if (pos = findpos (v, new), if (#v > pos, if (v[#v] == v[#v - pos], return (pos)););); n = new; k = -k; v = concat(v, new););}
    a(n) = my(k=3); while (loop(k) != 2*n, k++); k;

Extensions

a(19)-a(27) from Giovanni Resta, Jun 06 2017

A348093 Numbers k >= 1 such that there is no pair (x,y) such that x - d(x) = k or y + d(y) = k, where d = A000005 = number of divisors.

Original entry on oeis.org

8, 20, 36, 40, 67, 68, 79, 88, 100, 116, 117, 131, 132, 134, 140, 156, 164, 167, 180, 185, 196, 204, 228, 244, 252, 268, 276, 284, 300, 308, 312, 321, 324, 341, 348, 370, 372, 379, 388, 401, 405, 408, 420, 425, 436, 439, 453, 460, 476, 479
Offset: 1

Views

Author

Ctibor O. Zizka, Sep 29 2021

Keywords

Comments

Numbers k >= 1 such that A060990(k) + A036431(k) = 0.

Examples

			k = 8 is a term: there are no x,y such that x - d(x) = 8, y + d(y) = 8.
		

Crossrefs

Intersection of A036434 and A045765.

Programs

  • Mathematica
    With[{max = 480}, Complement[Range[max], Select[Union[Flatten[Table[n + DivisorSigma[0, n]*{-1, 1}, {n, 1, max + 2 + 2*Ceiling[Sqrt[2*max+4]]}]]], # <= max &]]] (* Amiram Eldar, Mar 04 2023 *)
  • PARI
    okp(k) = sum(i=1, k, i+numdiv(i) == k) == 0;
    okm(k) = sum(i=1, 2*k+2, i-numdiv(i) == k) == 0;
    isok(k) = okp(k) && okm(k); \\ Michel Marcus, Oct 01 2021

A377539 The number of iterations of the map x -> x + A000005(x), starting from n, until reaching an even number, and always at least one iteration taken.

Original entry on oeis.org

1, 1, 4, 3, 3, 1, 2, 1, 1, 1, 6, 1, 5, 1, 4, 3, 4, 1, 3, 1, 2, 1, 2, 1, 1, 1, 16, 1, 16, 1, 15, 1, 14, 1, 13, 11, 13, 1, 12, 1, 12, 1, 11, 1, 10, 1, 2, 1, 1, 1, 9, 1, 9, 1, 8, 1, 7, 1, 7, 1, 6, 1, 5, 5, 5, 1, 5, 1, 4, 1, 4, 1, 3, 1, 2, 1, 2, 1, 2, 1, 1, 1, 38, 1, 37, 1, 36, 1, 36, 1, 35, 1, 35
Offset: 1

Views

Author

Ctibor O. Zizka, Oct 31 2024

Keywords

Comments

The iteration step is x -> A062249(x).
a(n) = 1 if and only if n is an odd square (A016754) or an even nonsquare (A157502). - Robert Israel, Oct 31 2024
Therefore, a(n) = 1 <=> A323158(n) = 0. - Antti Karttunen, Jan 15 2025

Examples

			For n = 2, there is a(2) = 1 iteration to an even number: 2 -> 4 (with at least one iteration so 2 itself is not the even number target).
For n = 3 there are a(3) = 4 iterations to reach an even number: 3 -> 5 -> 7 -> 9 -> 12.
		

Crossrefs

Cf. A000005, A062249 (step), A064491 (trajectory of 1), A016754, A157502, A323158.

Programs

  • Maple
    f:= proc(n) local x,i;
      x:= n;
      for i from 1 do x:= x + numtheory:-tau(x); if x::even then return i fi od
    end proc:
    map(f, [$1..200]); # Robert Israel, Oct 31 2024
  • Mathematica
    a[n_] := -1 + Length@ NestWhileList[# + DivisorSigma[0, #] &, n, OddQ, {2, 1}]; Array[a, 100] (* Amiram Eldar, Oct 31 2024 *)
  • PARI
    A377539(n) = for(i=1,oo,if(!((n=(n+numdiv(n)))%2),return(i))); \\ Antti Karttunen, Jan 15 2025

A330877 Number of steps needed to reach zero or a cycle when starting from k = n and repeatedly applying the map that replaces k by k - d(k) if k is even, by k + d(k) if k is odd, where d(k) is the number of divisors of k (A000005).

Original entry on oeis.org

0, 2, 1, 7, 3, 6, 2, 5, 4, 4, 3, 12, 3, 11, 4, 10, 13, 10, 4, 9, 5, 8, 5, 8, 14, 7, 6, 32, 6, 32, 6, 31, 7, 30, 7, 29, 33, 29, 8, 28, 8, 28, 8, 27, 9, 26, 9, 12, 9, 11, 10, 25, 10, 25, 10, 24, 10, 23, 11, 23, 10, 22, 12, 21, 24, 21, 12, 21, 13
Offset: 0

Views

Author

Ctibor O. Zizka, Apr 29 2020

Keywords

Comments

First cycle we see for n = 83. The length of the cycle is 38 steps. To reach a cycle means the time to first step into the loop.

Examples

			n = 1, mapping steps are 1 + 1 = 2, 2 - 2 = 0, a(1) = 2;
n = 2, mapping steps are 2 - 2 = 0, a(2) = 1;
n = 3, mapping steps are 3 + 2 = 5, 5 + 2 = 7, 7 + 2 = 9, 9 + 3 = 12, 12 - 6 = 6, 6 - 4 = 2, 2 - 2 = 0, a(3) = 7;
n = 4, mapping steps are 4 - 3 = 1, 1 + 1 = 2, 2 - 2 = 0, a(4) = 3;
n = 5, mapping steps are 5 + 2 = 7, 7 + 2 = 9, 9 + 3 = 12, 12 - 6 = 6, 6 - 4 = 2, 2 - 2 = 0, a(5) = 6.
		

Crossrefs

A348337 For n >= 1; x = n, then iterate x --> x + d(x) until d(x + d(x)) >= d(x). a(n) gives the number of iteration steps where d(i) is the number of divisors of i, A000005(i).

Original entry on oeis.org

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

Views

Author

Ctibor O. Zizka, Oct 13 2021

Keywords

Comments

a(n) = 1 for n from A260577.

Examples

			n = 1; x(1) = 1 + d(1) = 2, d(1 + d(1)) >= d(1) thus x(2) = 2 + d(2) = 4, d(2 + d(2)) >= d(2) thus x(3) = 4 + d(4) = 7, d(4 + d(4)) < d(4), stop. a(1) = 3.
		

Crossrefs

Programs

  • Mathematica
    d[n_] := DivisorSigma[0, n]; x[n_] := n + d[n]; a[n_] := Length@ NestWhileList[x, n, d[#] <= d[x[#]] &]; Array[a, 100] (* Amiram Eldar, Oct 15 2021 *)

A377937 Number of primes in the interval [n - A000005(n), n + A000005(n)].

Original entry on oeis.org

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

Views

Author

Ctibor O. Zizka, Nov 11 2024

Keywords

Examples

			n = 1, there is one prime in [0, 2], thus a(1) = 1.
n = 6, there are four primes in [2, 10], thus a(6) = 4.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{d = DivisorSigma[0, n]}, PrimePi[n + d] - PrimePi[n - d - 1]]; Array[a, 100] (* Amiram Eldar, Nov 11 2024 *)

Formula

a(n) = pi(n+tau(n)) - pi(n-tau(n)-1).
Previous Showing 11-18 of 18 results.