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-9 of 9 results.

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)

A334100 Square array where the row n lists all numbers k for which A329697(k) = n, read by falling antidiagonals.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 8, 6, 9, 19, 16, 10, 11, 21, 43, 32, 12, 13, 23, 47, 127, 64, 17, 14, 27, 49, 129, 283, 128, 20, 15, 29, 57, 133, 301, 659, 256, 24, 18, 31, 59, 139, 329, 817, 1319, 512, 34, 22, 33, 63, 141, 343, 827, 1699, 3957, 1024, 40, 25, 35, 67, 147, 347, 839, 1787, 4079, 9227, 2048, 48, 26, 37, 69, 161, 361, 849, 1849, 4613, 9233, 21599
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Array is read by descending antidiagonals with (n,k) = (0,1), (0,2), (1,1), (0,3), (1,2), (2,1), ... where A(n,k) is the k-th solution x to A329697(x) = n. The row indexing (n) starts from 0, and column indexing (k) from 1.
Any odd prime that appears on row n is 1+{some term on row n-1}.
The e-th powers of the terms on row n form a subset of terms on row (e*n). More generally, a product of terms that occur on rows i_1, i_2, ..., i_k can be found at row (i_1 + i_2 + ... + i_k), because A329697 is completely additive.
The binary weight (A000120) of any term on row n is at most 2^n.

Examples

			The top left corner of the array:
  n\k |    1     2     3     4     5     6     7     8     9    10
------+----------------------------------------------------------------
   0  |    1,    2,    4,    8,   16,   32,   64,  128,  256,  512, ...
   1  |    3,    5,    6,   10,   12,   17,   20,   24,   34,   40, ...
   2  |    7,    9,   11,   13,   14,   15,   18,   22,   25,   26, ...
   3  |   19,   21,   23,   27,   29,   31,   33,   35,   37,   38, ...
   4  |   43,   47,   49,   57,   59,   63,   67,   69,   71,   77, ...
   5  |  127,  129,  133,  139,  141,  147,  161,  163,  171,  173, ...
   6  |  283,  301,  329,  343,  347,  361,  379,  381,  383,  387, ...
   7  |  659,  817,  827,  839,  849,  863,  883,  889,  893,  903, ...
   8  | 1319, 1699, 1787, 1849, 1977, 1979, 1981, 2021, 2039, 2083, ...
   9  | 3957, 4079, 4613, 4903, 5097, 5179, 5361, 5377, 5399, 5419, ...
etc.
Note that the row 9 is the first one which begins with composite, as 3957 = 3*1319. The next such rows are row 15 and row 22. See A334099.
		

Crossrefs

Cf. A329697.
Cf. A334099 (the leftmost column).
Cf. A000079, A334101, A334102, A334103, A334104, A334105, A334106 for the rows 0-6.
Cf. A019434, A334092, A334093, A334094, A334095, A334096 for the primes on the rows 1-6.
Cf. also irregular triangle A334111.

Programs

  • Mathematica
    Block[{nn = 16, s}, s = Values@ PositionIndex@ Array[-1 + Length@ NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, #, # != 2^IntegerExponent[#, 2] &] &, 2^nn]; Table[s[[#, k]] &[m - k + 1], {m, nn - Ceiling[nn/4]}, {k, m, 1, -1}]] // Flatten (* Michael De Vlieger, Apr 30 2020 *)
  • PARI
    up_to = 105; \\ up_to = 1081; \\ = binomial(46+1,2)
    A329697(n) = if(!bitand(n,n-1),0,1+A329697(n-(n/vecmax(factor(n)[, 1]))));
    memoA334100sq = Map();
    A334100sq(n, k) = { my(v=0); if(!mapisdefined(memoA334100sq,[n,k-1],&v),if(1==k, v=0, v = A334100sq(n, k-1))); for(i=1+v,oo,if(A329697(i)==(n-1),mapput(memoA334100sq,[n,k],i); return(i))); };
    A334100list(up_to) = { my(v = vector(up_to), i=0); for(a=1,oo, for(col=1,a, i++; if(i > up_to, return(v)); v[i] = A334100sq(col,(a-(col-1))))); (v); };
    v334100 = A334100list(up_to);
    A334100(n) = v334100[n];

A334102 Numbers n for which A329697(n) == 2.

Original entry on oeis.org

7, 9, 11, 13, 14, 15, 18, 22, 25, 26, 28, 30, 36, 41, 44, 50, 51, 52, 56, 60, 72, 82, 85, 88, 97, 100, 102, 104, 112, 120, 137, 144, 164, 170, 176, 193, 194, 200, 204, 208, 224, 240, 274, 288, 289, 328, 340, 352, 386, 388, 400, 408, 416, 448, 480, 548, 576, 578, 641, 656, 680, 704, 769, 771, 772, 776, 800, 816, 832, 896, 960, 1096
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Numbers n for which A171462(n) = n-A052126(n) is in A334101.
Numbers k such that A000265(k) is either in A333788 or in A334092.
Each term is either of the form A334092(n)*2^k, for some n >= 1, and k >= 0, or a product of two terms of A334101, whether distinct or not.
Binary weight (A000120) of these terms is always either 2, 3 or 4. It is 2 for those terms that are of the form 9*2^k, 4 for the terms of the form p*q*2^k, where p and q are two distinct Fermat primes (A019434), and 3 for the both terms of the form A334092(n)*2^k, and for the terms of the form (p^2)*(2^k), where p is a Fermat prime > 3.

Crossrefs

Row 2 of A334100.
Cf. A333788 (a subsequence), A334092 (primes present), A334093 (primes that are 1 + some term in this sequence).
Squares of A334101 form a subsequence of this sequence. Squares of these numbers can be found (as a subset) in A334104, and the cubes in A334106.

Programs

A334103 Numbers n for which A329697(n) == 3.

Original entry on oeis.org

19, 21, 23, 27, 29, 31, 33, 35, 37, 38, 39, 42, 45, 46, 53, 54, 55, 58, 61, 62, 65, 66, 70, 73, 74, 75, 76, 78, 83, 84, 89, 90, 92, 101, 103, 106, 108, 110, 113, 116, 119, 122, 123, 124, 125, 130, 132, 140, 146, 148, 150, 152, 153, 156, 166, 168, 178, 180, 184, 187, 202, 205, 206, 212, 216, 220, 221, 226, 232, 238, 241, 244
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Numbers n for which A171462(n) = n-A052126(n) is in A334102.
Among the first 2821 terms (terms < 2^31), there are terms with binary weights 2, 3, 4, 5, 6 and 8. For example, 33 is the first term with binary weight 2, and 255 is the first term with binary weight 8.

Crossrefs

Row 3 of A334100.
Cf. A334093 (primes present), A334094.

Programs

A334094 Primes p for which A329697(p) == 4.

Original entry on oeis.org

43, 47, 59, 67, 71, 79, 107, 109, 131, 149, 151, 157, 167, 179, 181, 227, 233, 239, 251, 281, 293, 307, 313, 337, 433, 443, 521, 593, 601, 613, 673, 809, 821, 823, 881, 929, 953, 971, 977, 1021, 1201, 1217, 1249, 1637, 1697, 1931, 2081, 2113, 2309, 2657, 2689, 2741, 2789, 2819, 3203, 3209, 3299, 3457, 3469, 3593, 3617, 3847, 3881, 4001
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Primes p of the form of the form A334103(n) + 1, for some n >= 1.

Crossrefs

Programs

A334106 Numbers n for which A329697(n) == 6.

Original entry on oeis.org

283, 301, 329, 343, 347, 361, 379, 381, 383, 387, 399, 413, 417, 419, 423, 431, 437, 441, 463, 469, 473, 483, 487, 489, 491, 497, 509, 513, 517, 519, 523, 529, 531, 539, 547, 551, 553, 557, 559, 566, 567, 571, 573, 589, 591, 597, 599, 602, 603, 609, 611, 621, 627, 631, 633, 635, 637, 639, 643, 645, 649, 651, 653, 658, 665
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Crossrefs

Row 6 of A334100.
Cf. A334096 (primes present).

Programs

A334095 Primes p for which A329697(p) == 5.

Original entry on oeis.org

127, 139, 163, 173, 191, 197, 199, 211, 223, 229, 263, 269, 271, 277, 311, 317, 331, 349, 359, 367, 373, 397, 421, 439, 457, 461, 467, 479, 499, 503, 541, 563, 569, 587, 607, 617, 619, 647, 661, 677, 701, 733, 739, 751, 761, 857, 877, 887, 919, 937, 997, 1009, 1031, 1049, 1061, 1069, 1123, 1187, 1193, 1213, 1229, 1231
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Primes p of the form of the form A334104(n) + 1, for some n >= 1.

Crossrefs

Programs

A334105 Numbers m for which A329697(m) = 5.

Original entry on oeis.org

127, 129, 133, 139, 141, 147, 161, 163, 171, 173, 177, 189, 191, 197, 199, 201, 203, 207, 209, 211, 213, 215, 217, 223, 229, 231, 235, 237, 243, 245, 247, 253, 254, 258, 259, 261, 263, 266, 269, 271, 273, 277, 278, 279, 282, 285, 294, 295, 297, 299, 311, 315, 317, 319, 321, 322, 326, 327, 331, 333, 335, 341, 342, 345, 346, 349, 351
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Examples

			127 = 63*2 + 1 is a term, as 127 is a prime and 63 is in A334104 as A329697(63) = 4.
2^32 -1 = 4294967295 = 3*5*17*257*65537 is a term as it is a product of five Fermat primes, thus in five steps all odd primes can be eliminated with p -> (p-1) map.
Likewise for 1442840405 = 5 * 17 * 257^3. (The first term with binary weight = 24).
		

Crossrefs

Row 5 of A334100.
Cf. A334095 (primes present).

Programs

  • Mathematica
    Position[Array[Length@ NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, #, # != 2^IntegerExponent[#, 2] &] - 1 &, 360], 5][[All, 1]] (* Michael De Vlieger, Apr 30 2020 *)
  • PARI
    A329697(n) = if(!bitand(n,n-1),0,1+A329697(n-(n/vecmax(factor(n)[, 1]))));
    isA334105(n) = (5==A329697(n));

A359585 Positions of even terms in A329697.

Original entry on oeis.org

1, 2, 4, 7, 8, 9, 11, 13, 14, 15, 16, 18, 22, 25, 26, 28, 30, 32, 36, 41, 43, 44, 47, 49, 50, 51, 52, 56, 57, 59, 60, 63, 64, 67, 69, 71, 72, 77, 79, 81, 82, 85, 86, 87, 88, 91, 93, 94, 95, 97, 98, 99, 100, 102, 104, 105, 107, 109, 111, 112, 114, 115, 117, 118, 120, 121, 126, 128, 131, 134, 135, 137
Offset: 1

Views

Author

Antti Karttunen, Jan 07 2023

Keywords

Comments

Numbers that occur on even-indexed rows of array A334100.

Crossrefs

Positions of +1's in A359581, positions of 0's in A359583.
Cf. A329697, A334100, A359584 (complement).
Cf. A000079, A334102, A334104, A334106 (subsequences).

Programs

Showing 1-9 of 9 results.