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-10 of 22 results. Next

A332903 a(1) = 1, then after the first differences of A333123.

Original entry on oeis.org

1, 0, 0, 0, 0, 1, 0, -1, 1, 0, 0, 1, 0, 2, 0, -4, 0, 4, 0, -2, 7, -5, 0, -1, -1, 4, -2, 4, 0, 3, 0, -11, 16, -15, 19, -12, 0, 5, 2, -12, 0, 24, 0, -19, 12, -7, 0, -9, 23, -21, 0, 5, 0, 2, 2, -2, 14, -5, 0, -2, 0, 12, 9, -41, 32, 14, 0, -44, 58, -5, 0, -42, 0, 9, 5, 0, 75, -61, 0, -37, 9, -5, 0, 47, -48, 76, -5, -65, 0, 42, 42
Offset: 1

Views

Author

Antti Karttunen, Apr 04 2020

Keywords

Crossrefs

Programs

  • Mathematica
    Prepend[Differences[#], First[#]] &@ Nest[Append[#1, Sum[#1[[#2 - #2/p]], {p, FactorInteger[#2][[All, 1]]}]] & @@ {#, Length@ # + 1} &, {1}, 90] (* Michael De Vlieger, Apr 15 2020 *)
  • PARI
    up_to = 105;
    A333123list(up_to) = { my(v=vector(up_to)); v[1] = 1; for(n=2,up_to, v[n] = vecsum(apply(p -> v[n-n/p], factor(n)[, 1]~))); (v); };
    v333123 = A333123list(up_to);
    A333123(n) = v333123[n];
    A332903(n) = if(1==n,n,(A333123(n)-A333123(n-1)));

Formula

a(1) = 1, and for n > 1, a(n) = A333123(n) - A333123(n-1).
a(p) = 0 for all primes p.

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)

A064097 A quasi-logarithm defined inductively by a(1) = 0 and a(p) = 1 + a(p-1) if p is prime and a(n*m) = a(n) + a(m) if m,n > 1.

Original entry on oeis.org

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

Views

Author

Thomas Schulze (jazariel(AT)tiscalenet.it), Sep 16 2001

Keywords

Comments

Note that this is the logarithm of a completely multiplicative function. - Michael Somos
Number of iterations of r -> r - (largest divisor d < r) needed to reach 1 starting at r = n. a(n) = a(n - A032742(n)) + 1 for n >= 2. - Jaroslav Krizek, Jan 28 2010
From Antti Karttunen, Apr 04 2020: (Start)
Krizek's comment above stems from the fact that n - n/p = (p-1)*(n/p), where p is the least prime dividing n [= A020639(n), thus n/p = A032742(n)] and because this is fully additive sequence we can write a(n) = a(p) + a(n/p) = (1+a(p-1)) + a(n/p) = 1 + a((p-1)*(n/p)) = 1 + a(n - n/p), for any composite n.
Note that in above formula p can be any prime factor of n, not only the smallest, which proves Robert G. Wilson v's comment in A333123 that all such iteration paths from n to 1 are of the same length, regardless of the route taken.
(End)
From Antti Karttunen, May 11 2020: (Start)
Moreover, those paths form the chains of a graded poset, which is also a lattice. See the Mathematics Stack Exchange link.
Keeping the formula otherwise same, but changing it for primes either as a(p) = 1 + a(A064989(p)), a(p) = 1 + a(floor(p/2)) or a(p) = 1 + a(A048673(p)) gives sequences A056239, A064415 and A334200 respectively.
(End)
a(n) is the number of iterations r->A060681(r) to reach 1 starting at r=n. - R. J. Mathar, Nov 06 2023

Examples

			a(19) = 6: 19 - 1 = 18; 18 - 9 = 9; 9 - 3 = 6; 6 - 3 = 3; 3 - 1 = 2; 2 - 1 = 1. That is a total of 6 iterations. - _Jaroslav Krizek_, Jan 28 2010
From _Antti Karttunen_, Apr 04 2020: (Start)
We can follow also alternative routes, where we do not always select the largest proper divisor to subtract, for example, from 19 to 1, we could go as:
19-1 = 18; 18-(18/3) = 12; 12-(12/2) = 6; 6-(6/3) = 4; 4-(4/2) = 2; 2-(2/2) = 1, or as
19-1 = 18; 18-(18/3) = 12; 12-(12/3) = 8; 8-(8/2) = 4; 4-(4/2) = 2; 2-(2/2) = 1,
both of which also have exactly 6 iterations.
(End)
		

Crossrefs

Similar to A061373 which uses the same recurrence relation but a(1) = 1.
Cf. A000079 (position of last occurrence), A105017 (position of records), A334197 (positions of record jumps upward).
Partial sums of A334090.
Cf. also A056239.

Programs

  • Haskell
    import Data.List (genericIndex)
    a064097 n = genericIndex a064097_list (n-1)
    a064097_list = 0 : f 2 where
       f x | x == spf  = 1 + a064097 (spf - 1) : f (x + 1)
           | otherwise = a064097 spf + a064097 (x `div` spf) : f (x + 1)
           where spf = a020639 x
    -- Reinhard Zumkeller, Mar 08 2013
    
  • Maple
    a:= proc(n) option remember;
          add((1+a(i[1]-1))*i[2], i=ifactors(n)[2])
        end:
    seq(a(n), n=1..120);  # Alois P. Heinz, Apr 26 2019
    # alternative which can be even used outside this entry
    A064097 := proc(n)
            option remember ;
            add((1+procname(i[1]-1))*i[2], i=ifactors(n)[2]) ;
    end proc:
    seq(A064097(n),n=1..100) ; # R. J. Mathar, Aug 07 2022
  • Mathematica
    quasiLog := (Length@NestWhileList[# - Divisors[#][[-2]] &, #, # > 1 &] - 1) &;
    quasiLog /@ Range[1024]
    (* Terentyev Oleg, Jul 17 2011 *)
    fi[n_] := Flatten[ Table[#[[1]], {#[[2]]}] & /@ FactorInteger@ n]; a[1] = 0; a[n_] := If[ PrimeQ@ n, a[n - 1] + 1, Plus @@ (a@# & /@ fi@ n)]; Array[a, 105] (* Robert G. Wilson v, Jul 17 2013 *)
    a[n_] := Length@ NestWhileList[# - #/FactorInteger[#][[1, 1]] &, n, # != 1 &] - 1; Array[a, 100] (* or *)
    a[n_] := a[n - n/FactorInteger[n][[1, 1]]] +1; a[1] = 0; Array[a, 100]  (* Robert G. Wilson v, Mar 03 2020 *)
  • PARI
    NN=200; an=vector(NN);
    a(n)=an[n];
    for(n=2,NN,an[n]=if(isprime(n),1+a(n-1), sumdiv(n,p, if(isprime(p),a(p)*valuation(n,p)))));
    for(n=1,100,print1(a(n)", "))
    
  • PARI
    a(n)=if(isprime(n), return(a(n-1)+1)); if(n==1, return(0)); my(f=factor(n)); apply(a,f[,1])~ * f[,2] \\ Charles R Greathouse IV, May 10 2016
    
  • Scheme
    (define (A064097 n) (if (= 1 n) 0 (+ 1 (A064097 (A060681 n))))) ;; After Jaroslav Krizek's Jan 28 2010 formula.
    (define (A060681 n) (- n (A032742 n))) ;; See also code under A032742.
    ;; Antti Karttunen, Aug 23 2017

Formula

Conjectures: for n>1, log(n) < a(n) < (5/2)*log(n); lim n ->infinity sum(k=1, n, a(k))/(n*log(n)-n) = C = 1.8(4)... - Benoit Cloitre, Oct 30 2002
Conjecture: for n>1, floor(log_2(n)) <= a(n) < (5/2)*log(n). - Robert G. Wilson v, Aug 10 2013
a(n) = Sum_{k=1..n} a(p_k)*e_k if n is composite with factorization p_1^e_1 * ... * p_k^e_k. - Orson R. L. Peters, May 10 2016
From Antti Karttunen, Aug 23 2017: (Start)
a(1) = 0; for n > 1, a(n) = 1 + a(A060681(n)). [From Jaroslav Krizek's Jan 28 2010 formula in comments.]
a(n) = A073933(n) - 1. (End)
a(n) = A064415(n) + A329697(n) [= A054725(n) + A329697(n), for n > 1]. - Antti Karttunen, Apr 16 2020
a(n) = A323077(n) + A334202(n) = a(A052126(n)) + a(A006530(n)). - Antti Karttunen, May 12 2020

Extensions

More terms from Michael Somos, Sep 25 2001

A067513 Number of divisors d of n such that d+1 is prime.

Original entry on oeis.org

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

Views

Author

Amarnath Murthy, Feb 12 2002

Keywords

Comments

1, 2 and 4 are the only numbers such that for every divisor d, d+1 is a prime.
These and only these primes appear as prime divisors of any term of InvPhi(n) set if n is not empty, i.e., if n is from A002202. - Labos Elemer, Jun 24 2002
a(n) is the number of integers k such that n = k - k/p where p is one of the prime divisors of k. (See, e.g., A064097 and A333123, which are related to the mapping k -> k - k/p.) - Robert G. Wilson v, Jun 12 2022

Examples

			a(12) = 5 as the divisors of 12 are 1, 2, 3, 4, 6 and 12 and the corresponding primes are 2,3,5,7 and 13. Only 3+1 = 4 is not a prime.
		

Crossrefs

Even-indexed terms give A046886.
Cf. A005408 (positions of 1's), A051222 (of 2's).

Programs

  • Haskell
    a067513 = sum . map (a010051 . (+ 1)) . a027750_row
    -- Reinhard Zumkeller, Jul 31 2012
    
  • Maple
    A067513 := proc(n)
        local a,d;
        a := 0 ;
        for d in numtheory[divisors](n) do
            if isprime(d+1) then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    seq(A067513(n),n=1..100) ; # R. J. Mathar, Aug 07 2022
  • Mathematica
    a[n_] := Length[Select[Divisors[n]+1, PrimeQ]]
    Table[Count[Divisors[n],?(PrimeQ[#+1]&)],{n,110}] (* _Harvey P. Dale, Feb 29 2012 *)
    a[n_] := DivisorSum[n, 1 &, PrimeQ[# + 1] &]; Array[a, 100] (* Amiram Eldar, Jan 11 2025 *)
  • PARI
    a(n)=sumdiv(n,d,isprime(d+1)) \\ Charles R Greathouse IV, Dec 23 2011
    
  • Python
    from sympy import divisors, isprime
    def a(n): return sum(1 for d in divisors(n, generator=True) if isprime(d+1))
    print([a(n) for n in range(1, 104)]) # Michael S. Branicky, Jul 12 2022

Formula

a(n) = 2 iff Bernoulli number B_{n} has denominator 6 (cf. A051222). - Vladeta Jovovic, Feb 13 2002
a(n) <= A141197(n). - Reinhard Zumkeller, Oct 06 2008
a(n) = A001221(A027760(n)). - Enrique Pérez Herrero, Dec 23 2011
a(n) = Sum_{k = 1..A000005(n)} A010051(A027750(n,k)+1). - Reinhard Zumkeller, Jul 31 2012
a(n) = A001221(A185633(n)) = A001222(A322312(n)). - Antti Karttunen, Jul 12 2022
Sum_{k=1..n} a(k) = n * (log(log(n)) + B) + O(n/log(n)), where B is a constant (Prachar, 1955). - Amiram Eldar, Jan 11 2025

Extensions

Edited by Dean Hickerson, Feb 12 2002

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

Views

Author

Antti Karttunen, Apr 04 2020

Keywords

Comments

The count includes also n itself, and the final 1 when it is distinct from n.
a(n) >= A000005(n) because all divisors of n can be found in the union of those paths. - Antti Karttunen, Apr 19 2020

Examples

			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.
		

Crossrefs

Cf. A064097, A332810, A333123, A334230, A334231, A333786 (first occurrence of each n), A334112.
Partial sums of A332902.
See A332904 for the sum.

Programs

  • Mathematica
    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 *)
  • PARI
    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];
    
  • Python
    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

Formula

a(p) = 1 + a(p-1) for all primes p.
a(n) = n - A332810(n).
a(n) = A334112(n) + A000005(n). - Antti Karttunen, May 09 2020

A334111 Irregular triangle where row n gives all terms k for which A064097(k) = n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 12, 16, 11, 13, 14, 15, 17, 18, 20, 24, 32, 19, 21, 22, 25, 26, 27, 28, 30, 34, 36, 40, 48, 64, 23, 29, 31, 33, 35, 37, 38, 39, 41, 42, 44, 45, 50, 51, 52, 54, 56, 60, 68, 72, 80, 96, 128, 43, 46, 49, 53, 55, 57, 58, 61, 62, 63, 65, 66, 70, 73, 74, 75, 76, 78, 81, 82, 84
Offset: 0

Views

Author

Keywords

Comments

Applying map k -> (p-1)*(k/p) to any term k on any row n > 1, where p is any prime factor of k, gives one of the terms on preceding row n-1.
Any 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 A064097 is completely additive.
A001221(k) gives the number of terms on the row above that are immediate descendants of k.
A067513(k) gives the number of terms on the row below that lead to k.

Examples

			Rows 0-6 of the irregular table:
0 |   1;
1 |   2;
2 |   3, 4;
3 |   5, 6, 8;
4 |   7, 9, 10, 12, 16;
5 |  11, 13, 14, 15, 17, 18, 20, 24, 32;
6 |  19, 21, 22, 25, 26, 27, 28, 30, 34, 36, 40, 48, 64;
		

Crossrefs

Cf. A105017 (left edge), A000079 (right edge), A175125 (row lengths).
Cf. also A058812, A334100.

Programs

  • Mathematica
    f[n_] := Length@ NestWhileList[# - #/FactorInteger[#][[1, 1]] &, n, # != 1 &]; SortBy[ Range@70, f]
    (* Second program *)
    With[{nn = 8}, Values@ Take[KeySort@ PositionIndex@ Array[-1 + Length@ NestWhileList[# - #/FactorInteger[#][[1, 1]] &, #, # > 1 &] &, 2^nn], nn + 1]] // Flatten (* Michael De Vlieger, Apr 18 2020 *)
  • PARI
    A060681(n) = (n-if(1==n,n,n/vecmin(factor(n)[,1])));
    A064097(n) = if(1==n,0,1+A064097(A060681(n)));
    for(n=0, 10, for(k=1,2^n,if(A064097(k)==n, print1(k,", "))));

A334184 Irregular table read by rows: T(n,k) gives the number of values that can be reached after exactly k iterations of maps of the form (n - n/p) where p is a prime divisor of n. 0 <= k < A073933(n).

Original entry on oeis.org

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

Views

Author

Peter Kagey, Apr 17 2020

Keywords

Comments

Row lengths are given by A073933(n). Row sums are given by A332809(n). The maximum value in each row is given by A334144(n).
The n-th row consists of all 1's if and only if n is a power of two (A000079) or a Fermat prime (A019434).
Conjecture: rows are unimodal (increasing and then decreasing).
Not all rows are unimodal. Indices of rows that have terms that increase and decrease more than once are A334238. - Michael De Vlieger, Apr 18 2020

Examples

			For n = 15, the fifteenth row of this table is [1,2,3,2,1,1] because there is one value (15 itself) that can be reached with zero iterations of (n - n/p) maps, two values (10 and 12) that can be reached after one iteration, three values (5, 8, and 6) that can be reached after two iterations, and so on.
      15
     _/ \_
    /     \
  10       12
  | \_   _/ |
  |   \ /   |
  5    8    6
   \_  |  _/|
     \_|_/  |
       4    3
       |  _/
       |_/
       2
       |
       |
       1
Table begins:
1
1, 1
1, 1, 1
1, 1, 1
1, 1, 1, 1
1, 2, 1, 1
1, 1, 2, 1, 1
1, 1, 1, 1
1, 1, 2, 1, 1
1, 2, 1, 1, 1
1, 1, 2, 1, 1, 1
1, 2, 2, 1, 1
1, 1, 2, 2, 1, 1
1, 2, 2, 2, 1, 1
1, 2, 3, 2, 1, 1
1, 1, 1, 1, 1
		

Crossrefs

Programs

  • Mathematica
    Table[Length@ Union@ # & /@ Transpose@ # &@ If[n == 1, {{1}}, NestWhile[If[Length[#] == 0, Map[{n, #} &, # - # /FactorInteger[#][[All, 1]] ], Union[Join @@ Map[Function[{w, n}, Map[Append[w, If[n == 0, 0, n - n/#]] &, FactorInteger[n][[All, 1]] ]] @@ {#, Last@ #} &, #]]] &, n, If[ListQ[#], AllTrue[#, Last[#] > 1 &], # > 1] &]], {n, 22}] // Flatten (* Michael De Vlieger, Apr 18 2020 *)

Formula

T(n,0) = T(n, A073933(n) - 2) = T(n, A073933(n) - 1) = 1.
T(n,1) = A001221(n) for n > 1.

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).

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

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}, 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.
		

Crossrefs

Programs

  • PARI
    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];

Formula

a(n) = n*A333123(n) + Sum_{p prime and dividing n} a(n - n/p).
For all n, a(n) >= A332904(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-10 of 22 results. Next