A333123
Consider the mapping k -> (k - (k/p)), where p is any of k's prime factors. a(n) is the number of different possible paths from n to 1.
Original entry on oeis.org
1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 3, 3, 5, 5, 1, 1, 5, 5, 3, 10, 5, 5, 4, 3, 7, 5, 9, 9, 12, 12, 1, 17, 2, 21, 9, 9, 14, 16, 4, 4, 28, 28, 9, 21, 14, 14, 5, 28, 7, 7, 12, 12, 14, 16, 14, 28, 23, 23, 21, 21, 33, 42, 1, 33, 47, 47, 3, 61, 56, 56, 14, 14, 23, 28, 28, 103, 42, 42, 5
Offset: 1
a(1): {1}, therefore a(1) = 1;
a(6): {6, 4, 2, 1} or {6, 3, 2, 1}, therefore a(6) = 2;
a(12): {12, 8, 4, 2, 1}, {12, 6, 4, 2, 1} or {12, 6, 3, 2, 1}, therefore a(12) = 3;
a(14): {14, 12, 8, 4, 2, 1}, {14, 12, 6, 4, 2, 1}, {14, 12, 6, 3, 2, 1}, {14, 7, 6, 4, 2, 1} or {14, 7, 6, 3, 2, 1}, therefore a(14) = 5.
From _Antti Karttunen_, Apr 05 2020: (Start)
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}, therefore a(15) = 5. These form a graph illustrated below:
15
/ \
/ \
10 12
/ \ / \
/ \ / \
5 8 6
\_ | __/|
\__|_/ |
4 3
\ /
\ /
2
|
1
(End)
-
a[n_] := Sum[a[n - n/p], {p, First@# & /@ FactorInteger@n}]; a[1] = 1; (* after PARI coding by Rémy Sigrist *) Array[a, 70]
(* view the various paths *)
f[n_] := Block[{i, j, k, p, q, mtx = {{n}}}, Label[start]; If[mtx[[1, -1]] != 1, j = Length@ mtx; While[j > 0, k = mtx[[j, -1]]; p = First@# & /@ FactorInteger@k; q = k - k/# & /@ p; pl = Length@p; If[pl > 1, Do[mtx = Insert[mtx, mtx[[j]], j], {pl - 1}]]; i = 1; While[i < 1 + pl, mtx[[j + i - 1]] = Join[mtx[[j + i - 1]], {q[[i]]}]; i++]; j--]; Goto[start], mtx]]
-
for (n=1, #a=vector(80), print1 (a[n]=if (n==1, 1, vecsum(apply(p -> a[n-n/p], factor(n)[,1]~)))", ")) \\ Rémy Sigrist, Mar 11 2020
A332809
Number of distinct integers encountered on possible paths from n to 1 when iterating the nondeterministic map k -> k - k/p, where p is any of the prime factors of k.
Original entry on oeis.org
1, 2, 3, 3, 4, 5, 6, 4, 6, 6, 7, 7, 8, 9, 10, 5, 6, 9, 10, 8, 12, 10, 11, 9, 9, 11, 10, 12, 13, 14, 15, 6, 17, 8, 18, 12, 13, 14, 15, 10, 11, 17, 18, 13, 18, 15, 16, 11, 18, 12, 14, 14, 15, 14, 16, 15, 17, 17, 18, 18, 19, 20, 20, 7, 22, 23, 24, 10, 26, 24, 25, 15, 16, 17, 21, 18, 30, 20, 21, 12, 15, 14, 15, 22, 16, 24, 25, 16
Offset: 1
a(1): {1}, therefore a(1) = 1;
a(6): we have two alternative paths: {6, 4, 2, 1} or {6, 3, 2, 1}, with numbers [1, 2, 3, 4, 6] present, therefore a(6) = 5;
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) = 7;
a(14): we have five alternative paths: {14, 12, 8, 4, 2, 1}, {14, 12, 6, 4, 2, 1}, {14, 12, 6, 3, 2, 1}, {14, 7, 6, 4, 2, 1} or {14, 7, 6, 3, 2, 1}, with numbers [1, 2, 3, 4, 6, 7, 8, 12, 14] present in at least one of the paths, therefore a(14) = 9.
-
a[n_] := Block[{lst = {{n}}}, While[lst[[-1]] != {1}, lst = Join[ lst, {Union[ Flatten[# - #/(First@# & /@ FactorInteger@#) & /@ lst[[-1]]]]}]]; Length@ Union@ Flatten@ lst]; Array[a, 75] (* Robert G. Wilson v, Apr 06 2020 *)
-
up_to = 105;
A332809list(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(length,v); }
v332809 = A332809list(up_to);
A332809(n) = v332809[n];
-
from sympy import factorint
from functools import cache
@cache
def b(n): return {n}.union(*(b(n - n//p) for p in factorint(n)))
def a(n): return len(b(n))
print([a(n) for n in range(1, 89)]) # Michael S. Branicky, Aug 13 2022
A332994
a(1) = 1, for n > 1, a(n) = n + a(A052126(n)).
Original entry on oeis.org
1, 3, 4, 7, 6, 9, 8, 15, 13, 13, 12, 19, 14, 17, 19, 31, 18, 27, 20, 27, 25, 25, 24, 39, 31, 29, 40, 35, 30, 39, 32, 63, 37, 37, 41, 55, 38, 41, 43, 55, 42, 51, 44, 51, 58, 49, 48, 79, 57, 63, 55, 59, 54, 81, 61, 71, 61, 61, 60, 79, 62, 65, 76, 127, 71, 75, 68, 75, 73, 83, 72, 111, 74, 77, 94, 83, 85, 87, 80, 111, 121
Offset: 1
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
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.
- Antti Karttunen, Table of n, a(n) for n = 1..16384
- Antti Karttunen, Data supplement: n, a(n) computed for n = 1..65537
- Michael De Vlieger, Graph montage of k -> k - k/p, with prime p|k for 2 <= k <= 211, red line showing path of greatest sum, blue the path of least sum (cf. A333790), and purple where the two paths coincide, with other paths in gray.
-
Array[Total@ NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, #, # > 1 &] &, 74] (* Michael De Vlieger, Apr 14 2020 *)
-
A333794(n) = if(1==n,n,n + A333794(n-(n/vecmax(factor(n)[, 1]))));
A333000
Sum of integers (with multiplicity) encountered on all possible paths from n to 1 when iterating 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, 25, 39, 15, 43, 47, 69, 76, 115, 185, 198, 31, 48, 209, 304, 138, 604, 317, 432, 203, 213, 500, 344, 640, 901, 899, 1271, 63, 1777, 179, 2274, 736, 1069, 1572, 1860, 361, 525, 3156, 4360, 1074, 2580, 2150, 2808, 506, 4528, 924, 1042, 1630, 2266, 1836, 2878, 1930, 5004, 4165, 5522, 3026, 4307, 6343, 7638, 127, 6801
Offset: 1
a(12): we have three alternative paths: {12, 8, 4, 2, 1}, {12, 6, 4, 2, 1} or {12, 6, 3, 2, 1}, therefore a(12) = (12+8+4+2+1) + (12+6+4+2+1) + (12+6+3+2+1) = 27+25+24 = 76
For n=15 we have five alternative paths from 15 to 1 (illustrated below): therefore a(15) = (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) = 37+40+42+40+39 = 198.
15
/ \
/ \
10 12
/ \ / \
/ \ / \
5 8 6
\__ | __/|
\_|_/ |
4 3
\ /
\ /
2
|
1.
-
up_to = 20000;
A333000list(up_to) = { my(u=vector(up_to), v=vector(up_to)); u[1] = v[1] = 1; for(n=2,up_to, u[n] = vecsum(apply(p -> u[n-n/p], factor(n)[, 1]~)); v[n] = (u[n]*n)+vecsum(apply(p -> v[n-n/p], factor(n)[, 1]~))); (v); };
v333000 = A333000list(up_to);
A333000(n) = v333000[n];
A333790
Smallest path sum 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, 22, 33, 24, 37, 33, 37, 31, 48, 39, 58, 42, 54, 55, 78, 48, 67, 63, 66, 61, 90, 67, 98, 63, 88, 82, 96, 75, 112, 96, 102, 82, 123, 96, 139, 99, 112, 124, 171, 96, 145, 117, 133, 115, 168, 120, 154, 117, 153, 148, 207, 127, 188, 160, 159, 127, 180, 154, 221, 150, 193, 166, 237, 147, 220, 186, 192, 172, 231
Offset: 1
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.
By choosing the path that follows the right edge of the above diagram, we obtain the smallest sum for any such path that goes from 119 to 1, thus a(119) = 119+112+56+28+14+7+6+3+2+1 = 348.
Note that if we always subtracted the largest proper divisor (A032742), i.e., iterated with A060681 (starting from 119), we would obtain 119-(119/7) = 102 -> 102-(102/2) -> 51-(51/3) -> 34-(34/2) -> 17-(17/17) -> 16-(16/2) -> 8-(8/2) -> 4-(4/2) -> 2-(2/2) -> 1, with sum 119+102+51+34+17+16+8+4+2+1 = 354 = A073934(119), which is NOT minimal sum in this case.
Differs from
A073934 for the first time at n=119, where a(119) = 348, while
A073934(119) = 354. (See
A333789).
-
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}}}, 76] (* Michael De Vlieger, Apr 14 2020 *)
-
up_to = 65537; \\ 2^20;
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(up_to);
A333790(n) = v333790[n];
Original entry on oeis.org
0, 0, 0, 0, 0, 1, 1, 0, 1, 3, 3, 3, 3, 8, 5, 0, 0, 6, 6, 9, 12, 18, 18, 7, 9, 18, 6, 22, 22, 18, 18, 0, 30, 15, 24, 16, 16, 33, 28, 21, 21, 37, 37, 48, 24, 69, 69, 15, 37, 36, 29, 48, 48, 25, 54, 50, 49, 77, 77, 44, 44, 73, 49, 0, 56, 83, 83, 45, 113, 75, 75, 36, 36, 71, 54, 87, 87, 81, 81, 45, 25, 84, 84, 87, 57, 128, 119, 108, 108, 71
Offset: 1
Showing 1-7 of 7 results.
Comments