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.

Showing 1-5 of 5 results.

A333789 Numbers k for which A333790(k) < A073934(k).

Original entry on oeis.org

119, 143, 187, 209, 221, 238, 239, 286, 319, 357, 374, 407, 418, 419, 429, 442, 443, 451, 476, 478, 479, 561, 572, 595, 627, 638, 663, 667, 671, 703, 713, 714, 715, 717, 748, 779, 803, 814, 833, 836, 838, 839, 851, 858, 859, 884, 886, 887, 902, 935, 943, 952, 953, 956, 957, 958, 979, 989, 1001, 1045, 1067, 1071, 1073, 1105, 1111, 1122
Offset: 1

Views

Author

Antti Karttunen, Apr 12 2020

Keywords

Comments

Numbers n for which the {smallest path sum when iterating from n to 1 with nondeterministic map k -> k - k/p, where p is any prime factor of k} cannot be obtained by always selecting the smallest prime factor of k (A020639). See the example in A333790 how that simple heuristic fails when starting from k=119.

Crossrefs

Programs

  • Mathematica
    Block[{a, b, nn = 1122}, a = Min@ Map[Total, #] & /@ Nest[Function[{a, n}, Append[a, Join @@ Table[Flatten@ Prepend[#, n] & /@ a[[n - n/p]], {p, FactorInteger[n][[All, 1]]}]]] @@ {#, Length@ # + 1} &, {{{1}}}, nn]; b = Array[If[# == 1, 1, Total@ NestWhileList[If[PrimeQ@ #, # - 1, # - #/FactorInteger[#][[1, 1]] ] &, #, # > 1 &]] &, nn]; Select[Range@ nn, a[[#]] < b[[#]] &]] (* Michael De Vlieger, Apr 15 2020 *)
  • PARI
    search_up_to = 2^17;
    A333790list(up_to) = { my(v=vector(up_to)); v[1] = 1; for(n=2, up_to, v[n] = n+vecmin(apply(p -> v[n-n/p], factor(n)[, 1]~))); (v); };
    v333790 = A333790list(search_up_to);
    A333790(n) = v333790[n];
    A073934(n) = if(1==n,n,n + A073934(n-(n/vecmin(factor(n)[,1]))));
    isA333789(n) = (A073934(n)!=A333790(n));

A329697 a(n) is the number of iterations needed to reach a power of 2 starting at n and using the map k -> k-(k/p), where p is the largest prime factor of k.

Original entry on oeis.org

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

Views

Author

Ali Sada and Robert G. Wilson v, Feb 28 2020

Keywords

Comments

From Antti Karttunen, Apr 07 2020: (Start)
Also the least number of iterations of nondeterministic map k -> k-(k/p) needed to reach a power of 2, when any prime factor p of k can be used. The minimal length path to the nearest power of 2 (= 2^A064415(n)) is realized whenever one uses any of the A005087(k) distinct odd prime factors of the current k, at any step of the process. For example, this could be done by iterating with the map k -> k-(k/A078701(k)), i.e., by using the least odd prime factor of k (instead of the largest prime).
Proof: Viewing the prime factorization of changing k as a multiset ("bag") of primes, we see that liquefying any odd prime p with step p -> (p-1) brings at least one more 2 to the bag, while applying p -> (p-1) to any 2 just removes it from the bag, but gives nothing back. Thus the largest (and thus also the nearest) power of 2 is reached by eliminating - step by step - all odd primes from the bag, but none of 2's, and it doesn't matter in which order this is done.
The above implies also that the sequence is totally additive, which also follows because both A064097 and A064415 are. That A064097(n) = A329697(n) + A054725(n) for all n > 1 can be also seen by comparing the initial conditions and the recursion formulas of these three sequences.
For any n, A333787(n) is either the nearest power of 2 reached (= 2^A064415(n)), or occurs on some of the paths from n to there.
(End)
A003401 gives the numbers k where a(k) = A005087(k). See also A336477. - Antti Karttunen, Mar 16 2021

Examples

			The trajectory of 15 is {12, 8}, taking 2 iterations to reach 8 = 2^3. So a(15) is 2.
From _Antti Karttunen_, Apr 07 2020: (Start)
Considering all possible paths from 15 to 1 nondeterministic map k -> k-(k/p), where p can be any prime factor of k, we obtain the following graph:
        15
       / \
      /   \
    10     12
    / \   / \
   /   \ /   \
  5     8     6
   \__  |  __/|
      \_|_/   |
        4     3
         \   /
          \ /
           2
           |
           1.
It can be seen that there's also alternative route to 8 via 10 (with 10 = 15-(15/3), where 3 is not the largest prime factor of 15), but it's not any shorter than the route via 12.
(End)
		

Crossrefs

Cf. A000079, A334101, A334102, A334103, A334104, A334105, A334106 for positions of 0 .. 6 in this sequence, and also array A334100.
Cf. A334099 (a right inverse, positions of the first occurrence of each n).
Cf. A334091 (first differences), A335429 (partial sums).
Cf. also A331410 (analogous sequence when using the map k -> k + k/p), A334861, A335877 (their sums and differences), see also A335878 and A335884, A335885.

Programs

  • Mathematica
    a[n_] := Length@ NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, n, # != 2^IntegerExponent[#, 2] &] -1; Array[a, 100]
  • PARI
    A329697(n) = if(!bitand(n,n-1),0,1+A329697(n-(n/vecmax(factor(n)[, 1])))); \\ Antti Karttunen, Apr 07 2020
    
  • PARI
    up_to = 2^24;
    A329697list(up_to) = { my(v=vector(up_to)); v[1] = 0; for(n=2, up_to, v[n] = if(!bitand(n,n-1),0,1+vecmin(apply(p -> v[n-n/p], factor(n)[, 1]~)))); (v); };
    v329697 = A329697list(up_to);
    A329697(n) = v329697[n]; \\ Antti Karttunen, Apr 07 2020
    
  • PARI
    A329697(n) = if(n<=2,0, if(isprime(n), A329697(n-1)+1, my(f=factor(n)); (apply(A329697, f[, 1])~ * f[, 2]))); \\ Antti Karttunen, Apr 19 2020

Formula

From Antti Karttunen, Apr 07-19 2020: (Start)
a(1) = a(2) = 0; and for n > 2, a(p) = 1 + a(p-1) if p is an odd prime and a(n*m) = a(n) + a(m) if m,n > 1. [This is otherwise equal to the definition of A064097, except here we have a different initial condition, with a(2) = 0].
a(2n) = a(A000265(n)) = a(n).
a(p) = 1+a(p-1), for all odd primes p.
If A209229(n) == 1 [when n is a power of 2], a(n) = 0,
otherwise a(n) = 1 + a(n-A052126(n)) = 1 + a(A171462(n)).
Equivalently, for non-powers of 2, a(n) = 1 + a(n-(n/A078701(n))),
or equivalently, for non-powers of 2, a(n) = 1 + Min a(n - n/p), for p prime and dividing n.
a(n) = A064097(n) - A064415(n), or equally, a(n) = A064097(n) - A054725(n), for n > 1.
a(A019434(n)) = 1, a(A334092(n)) = 2, a(A334093(n)) = 3, etc. for all applicable n.
For all n >= 0, a(A334099(n)) = a(A000244(n)) = a(A000351(n)) = a(A001026(n)) = a(257^n) = a(65537^n) = n.
a(A122111(n)) = A334107(n), a(A225546(n)) = A334109(n).
(End)
From Antti Karttunen, Mar 16 2021: (Start)
a(n) = a(A336466(n)) + A087436(n) = A336396(n) + A087436(n).
a(A053575(n)) = A336469(n) = a(n) - A005087(n).
a(A147545(n)) = A000120(A147545(n)) - 1.
(End)

A333794 a(1) = 1, for n > 1, a(n) = n + a(n-A052126(n)).

Original entry on oeis.org

1, 3, 6, 7, 12, 13, 20, 15, 22, 25, 36, 27, 40, 41, 42, 31, 48, 45, 64, 51, 66, 73, 96, 55, 76, 81, 72, 83, 112, 85, 116, 63, 118, 97, 120, 91, 128, 129, 130, 103, 144, 133, 176, 147, 136, 193, 240, 111, 182, 153, 162, 163, 216, 145, 208, 167, 202, 225, 284, 171, 232, 233, 208, 127, 236, 237, 304, 195, 306, 241, 312, 183, 256, 257
Offset: 1

Views

Author

Antti Karttunen, Apr 05 2020

Keywords

Comments

Conjecturally, also the largest path sum when iterating from n to 1 with nondeterministic map k -> k - k/p, where p is any prime factor of k.

Examples

			For n=119, the graph obtained is this:
              119
             _/\_
            /    \
          102    112
         _/|\_    | \_
       _/  |  \_  |   \_
      /    |    \ |     \
    51     68    96     56
    /|   _/ |   _/|   _/ |
   / | _/   | _/  | _/   |
  /  |/     |/    |/     |
(48) 34    64     48    28
     |\_    |    _/|   _/|
     |  \_  |  _/  | _/  |
     |    \_|_/    |/    |
    17     32     24    14
      \_    |    _/|   _/|
        \_  |  _/  | _/  |
          \_|_/    |/    |
           16      12    7
            |    _/|    _/
            |  _/  |  _/
            |_/    |_/
            8     _6
            |  __/ |
            |_/    |
            4      3
             \     /
              \_ _/
                2
                |
                1.
If we always subtract A052126(n) (i.e., n divided by its largest prime divisor), i.e., iterate with A171462 (starting from 119), we obtain 119-(119/17) = 112 -> 112-(112/7) -> 96-(96/3) -> 64-(64/2) -> 32-(32/2) -> 16-(16/2) -> 8-(8/2) -> 4-(4/2) -> 2-(2/2) -> 1, with sum 119+112+96+64+32+16+8+4+2+1 = 554, thus a(119) = 554. This happens also to be maximal sum of any path in above diagram.
		

Crossrefs

Programs

  • Mathematica
    Array[Total@ NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, #, # > 1 &] &, 74] (* Michael De Vlieger, Apr 14 2020 *)
  • PARI
    A333794(n) = if(1==n,n,n + A333794(n-(n/vecmax(factor(n)[, 1]))));

Formula

a(1) = 1; and for n > 1, a(n) = n + a(A171462(n)) = n + a(n-A052126(n)).
a(n) = A073934(n) + A333793(n).
a(n) = n + Max a(n - n/p), for p prime and dividing n. [Conjectured, holds at least up to n=2^24]
For all n >= 1, A333790(n) <= a(n) <= A332904(n).
For all n >= 1, a(n) >= A332993(n). [Apparently, have to check!]

A332904 Sum of distinct integers encountered on all possible paths from n to 1 when iterating with nondeterministic map k -> k - k/p, where p is any of the prime factors of k.

Original entry on oeis.org

1, 3, 6, 7, 12, 16, 23, 15, 25, 30, 41, 36, 49, 57, 66, 31, 48, 63, 82, 66, 105, 99, 122, 76, 91, 115, 90, 125, 154, 156, 187, 63, 222, 114, 240, 139, 176, 196, 217, 138, 179, 251, 294, 215, 264, 284, 331, 156, 300, 213, 258, 247, 300, 220, 345, 261, 334, 348, 407, 336, 397, 429, 395, 127, 492, 512, 579, 246, 650, 546, 617, 291, 364
Offset: 1

Views

Author

Antti Karttunen, Apr 04 2020

Keywords

Examples

			a(12): we have three alternative paths: {12, 8, 4, 2, 1}, {12, 6, 4, 2, 1} or {12, 6, 3, 2, 1}, with numbers [1, 2, 3, 4, 6, 8, 12] present, therefore a(12) = 1+2+3+4+6+8+12 = 36.
For n=15 we have five alternative paths from 15 to 1: {15, 10, 5, 4, 2, 1}, {15, 10, 8, 4, 2, 1}, {15, 12, 8, 4, 2, 1},  {15, 12, 6, 4, 2, 1},  {15, 12, 6, 3, 2, 1}. These form a lattice illustrated below:
        15
       / \
      /   \
    10     12
    / \   / \
   /   \ /   \
  5     8     6
   \__  |  __/|
      \_|_/   |
        4     3
         \   /
          \ /
           2
           |
           1,
therefore a(15) = 1+2+3+4+5+6+8+10+12+15 = 66.
		

Crossrefs

Cf. A333790 (sum of the route with minimal sum), A333794.

Programs

  • Mathematica
    Total /@ Nest[Function[{a, n}, Append[a, Union@ Flatten@ Table[Append[a[[n - n/p]], n], {p, FactorInteger[n][[All, 1]]}]]] @@ {#, Length@ # + 1} &, {{1}}, 72] (* Michael De Vlieger, Apr 15 2020 *)
  • PARI
    up_to = 20000;
    A332904list(up_to) = { my(v=vector(up_to)); v[1] = Set([1]); for(n=2,up_to, my(f=factor(n)[, 1]~, s=Set([n])); for(i=1,#f,s = setunion(s,v[n-(n/f[i])])); v[n] = s); apply(vecsum,v); }
    v332904 = A332904list(up_to);
    A332904(n) = v332904[n];

Formula

For all primes p, a(p) = a(p-1) + p.
For all n >= 1, A333000(n) >= a(n) >= A333794(n) >= A333790(n).

A333001 The average path sum (floored down) when iterating from n to 1 with nondeterministic map k -> k - k/p, where p is any prime factor of k.

Original entry on oeis.org

1, 3, 6, 7, 12, 12, 19, 15, 21, 23, 34, 25, 38, 37, 39, 31, 48, 41, 60, 46, 60, 63, 86, 50, 71, 71, 68, 71, 100, 74, 105, 63, 104, 89, 108, 81, 118, 112, 116, 90, 131, 112, 155, 119, 122, 153, 200, 101, 161, 132, 148, 135, 188, 131, 179, 137, 178, 181, 240, 144, 205, 192, 181, 127, 206, 191, 258, 170, 251, 199, 270, 160, 233, 218, 216
Offset: 1

Views

Author

Antti Karttunen, Apr 06 2020

Keywords

Examples

			a(12): we have three alternative paths: {12, 8, 4, 2, 1}, {12, 6, 4, 2, 1} or {12, 6, 3, 2, 1}, with path sums 27, 25, 24, whose average is 76/3 = 25.333..., therefore a(12) = 25.
For n=15 we have five alternative paths from 15 to 1 (illustrated below) with path sums 37, 40, 42, 40, 39, whose average is 198/5 = 39.6, therefore a(15) = 39.
        15
       / \
      /   \
    10     12
    / \   / \
   /   \ /   \
  5     8     6
   \_   |  __/|
     \__|_/   |
        4     3
         \   /
          \ /
           2
           |
           1.
		

Crossrefs

Cf. A333002/A333003 (average as exact rational, numerator/denominator in lowest terms), A333785 (where the average is an integer).
Cf. A333790 (smallest path sum), A333794 (conjectured largest path sum).

Programs

  • Mathematica
    Map[Floor@ Mean[Total /@ #] &, #] &@ Nest[Function[{a, n}, Append[a, Join @@ Table[Flatten@ Prepend[#, n] & /@ a[[n - n/p]], {p, FactorInteger[n][[All, 1]]}]]] @@ {#, Length@ # + 1} &, {{{1}}}, 74] (* Michael De Vlieger, Apr 15 2020 *)
  • PARI
    up_to = 20000;
    A333001list(up_to) = { my(u=vector(up_to), v=vector(up_to)); u[1] = v[1] = 1; for(n=2,up_to, my(ps=factor(n)[, 1]~); u[n] = vecsum(apply(p -> u[n-n/p], ps)); v[n] = (u[n]*n)+vecsum(apply(p -> v[n-n/p], ps))); vector(up_to, n, floor(v[n]/u[n])); };
    v333001 = A333001list(up_to);
    A333001(n) = v333001[n];

Formula

a(n) = floor(A333000(n)/A333123(n)) = floor(A333002(n)/A333003(n)).
Showing 1-5 of 5 results.