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.

User: Bernardo Recamán

Bernardo Recamán's wiki page.

Bernardo Recamán has authored 10 sequences.

A371862 Positive integers that can be written as the product of two or more other integers, none of which uses any of the digits in the number itself.

Original entry on oeis.org

4, 6, 8, 9, 10, 12, 14, 16, 18, 20, 21, 24, 27, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 49, 52, 54, 56, 57, 58, 60, 63, 64, 66, 68, 69, 70, 72, 76, 78, 80, 81, 84, 86, 87, 88, 90, 96, 98, 99, 100, 102, 104, 106, 108, 110, 111, 112, 114, 116, 117, 118, 120
Offset: 1

Author

Keywords

Comments

Infinite since 10^k = 2^k * 5^k and 10^k - 1 = 3^2 * (10^k - 1)/9 are terms for k > 0 and are the smallest (k+1)-digit and largest k-digit terms, resp. All repdigits consisting of 4's, 6's, 8's, or 9's are also terms. - Michael S. Branicky, Apr 09 2024
No number ending in 5 is a term. - Jon E. Schoenfield, Apr 09 2024
Terms are composite. If 9 consecutive positive integers are terms then they are between two consecutive primes at least 14 apart. - David A. Corneth, Apr 10 2024
All products of x (repdigits consisting of 3's or 6's) and 10x + 7 are terms. - Ivan N. Ianakiev, Apr 11 2024

Examples

			60 is a term because it can be expressed as 4 * 15, avoiding its own digits 6 and 0. 50 isn't because there is no way of expressing 50 avoiding both 5 and 0.
112 is a term since 112 = 4*4*7 and is the first term requiring a product with three factors.
		

Crossrefs

Programs

  • Python
    from sympy import divisors, isprime
    from functools import cache
    @cache
    def ok(n, avoid=tuple()):
        if avoid == tuple(): avoid = set(str(n))
        else: avoid = set(avoid)
        if n%10 == 5 or len(avoid) == 10 or isprime(n): return False
        for d in divisors(n)[1:-1]:
            if set(str(d)) & avoid == set():
                if set(str(n//d)) & avoid == set(): return True
                if ok(n//d, tuple(sorted(avoid))): return True
        return False
    print([k for k in range(200) if ok(k)]) # Michael S. Branicky, Apr 10 2024

A348300 a(n) is the largest number that is the digit sum of the square of an n-digit number.

Original entry on oeis.org

13, 31, 46, 63, 81, 97, 112, 130, 148, 162, 180, 193, 211, 229, 244, 262, 277, 297, 310, 331, 343, 360, 378, 396
Offset: 1

Author

Keywords

Comments

18*n-a(n) appears to be nondecreasing. - Chai Wah Wu, Nov 18 2021
According to new data 18*n-a(n) sometimes decreases. - David A. Corneth, Feb 21 2024
a(n) is the digit sum of the square of the last n-digit integer in A067179. - Zhao Hui Du, Mar 04 2024
a(n) appears to be approximately equal to 16.5*n. - Zhining Yang, Mar 12 2024
a(n) modulo 9 is either 0, 1, 4 or 7. - Chai Wah Wu, Apr 04 2024

Examples

			a(3) = 46 because 46 is the largest digital sum encountered among the squares (that of 937) of all 3-digit numbers. Such maximal digital sum can be achieved by more than one square (squares of 836 and 883 also have digital sum 46). Largest of these is A348303.
		

Crossrefs

Programs

  • Mathematica
    Array[Max@ Map[Total@ IntegerDigits[#^2] &, Range[10^(# - 1), 10^# - 1]] &, 8] (* Michael De Vlieger, Oct 12 2021 *)
  • Python
    def A348300(n): return max(sum(int(d) for d in str(m**2)) for m in range(10**(n-1),10**n)) # Chai Wah Wu, Jun 26 2024
  • Sage
    def A348300(n):
        return max(sum((k^2).digits()) for k in (10^(n-1)..10^n-1))
    

Formula

a(n) = Max_{k=10^(n-1)..10^n-1} A004159(k).

Extensions

a(11) from Chai Wah Wu, Nov 18 2021
a(12)-a(13) from Martin Ehrenstein, Nov 20 2021
a(14)-a(24) from Zhao Hui Du, Feb 23 2024
Name edited by Jon E. Schoenfield, Mar 10 2024

A348303 a(n) is the largest n-digit number whose square has a digital sum equal to A348300(n).

Original entry on oeis.org

7, 83, 937, 9417, 94863, 987917, 9893887, 99483667, 994927133, 9486778167, 99497231067, 999949483667, 9892825177313
Offset: 1

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Array[#1 + Position[#2, Max[#2]][[-1, -1]] - 1 & @@ {#1, Map[Total@ IntegerDigits[#^2] &, Range[#1, #2]]} & @@ {10^(# - 1), 10^# - 1} &, 8] (* Michael De Vlieger, Oct 12 2021 *)

Extensions

a(11) from Chai Wah Wu, Nov 18 2021
a(12)-a(13) from Martin Ehrenstein, Nov 20 2021

A298676 Number of partitions of n that can be uniquely recovered from their P-graphs.

Original entry on oeis.org

1, 2, 3, 5, 5, 7, 7, 10, 11, 13, 13, 18, 19, 26, 31, 36, 41, 48, 59, 71, 84, 94, 106, 123, 146, 165, 187, 210, 240, 275, 318, 364, 407, 465, 525, 593, 672, 756, 849, 966, 1080, 1207, 1354, 1530, 1718, 1925, 2135, 2377, 2667, 2997, 3351, 3736, 4141, 4598, 5125
Offset: 1

Author

Bernardo Recamán, Jan 28 2018

Keywords

Comments

a(n) is the number of partitions of n that can be uniquely recovered from its P-graph, the simple graph whose vertices are the parts of the partition, two of which are joined by an edge if, and only if, they have a common factor greater than 1.

Examples

			a(1) = 1 because the sole partition of 1 can be recovered from its P-graph, a single vertex.
a(2) = 2 because both partitions of 2 can be recovered from their corresponding P-graphs.
		

Programs

  • Mathematica
    pgraph[p_] := With[{v = Range[Length[p]]}, Graph[v, UndirectedEdge @@@ Select[Subsets[v, {2}], !CoprimeQ @@ p[[#]] &]]];
    a[n_] := Count[Length /@ Gather[pgraph /@ IntegerPartitions[n], IsomorphicGraphQ], 1];
    Array[a, 20]
    (* Andrey Zabolotskiy, Jan 30 2018 *)

Extensions

a(23)-a(50) from Freddy Barrera, Jan 29 2018
a(51)-a(55) from Andrey Zabolotskiy, Jan 30 2018

A273089 Number of lattice n-gons with ordered sides 1, 2, 3, ..., n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 5, 6, 0, 0, 584, 882, 0, 0, 18026, 194741, 0, 0, 644414, 960834, 0, 0, 229910636
Offset: 1

Author

Bernardo Recamán, May 14 2016

Keywords

Comments

First 16 terms calculated by Stefan Kohl.

Examples

			a(8) = 3:
  . . . . . ._._._.   . . . . . . . .    ._._._._._._._.
  . . . . . | . . |   . . . . . . . .    | . . . . . . |
  . . . . . | . ._|   ._._._._._._._.    | . . . . . . |
  . . . . . | . | .   | . . . . . . |    | . . . . . . |
  ._._._._._| . | .   | . . .   . . |    | . . . . . . |
  | . . . . . . | .   | . . . |\. . |    | . . . . . . |
  | . . . . . . | .   | . . . | \ . |    | ._._._. . . |
  | . . . . . . | .   | . . . | .\5 |    | | . . | . ./.
  | . . . . . . | .   | ._._._| . .\|    |_| . . | ./5 .
  | . . . . . . | .   | | . . . . . .    . . . . | / . .
  |_._._._._._._| .   |_| . . . . . .    . . . . |/. . .
.
a(11) = 5:
  . . . . . . . . . . . ._._._._._._._._._. . . . . . . .
  . . . . . . . . . . . .\. . . . . . . . | . . . . . . .
  . . . . . . . . . . . . . \ . . . . . . | . . . . . . .
  . . . . . . . ._._._. . . . .\. . . . . | . . . . . . .
  . . . . . . . | . . | . . . . .10 . . . | . . . . . . .
  . . . . . . ._| . . | . . . . . . \ . . | . . . . . . .
  . . . . . . | . . . | . . . . . . . .\. | . . . . . . .
  . . . . . . | . . . | . . . . . . . . | | . . . . . . .
  . . . . . . | . . . . \ . . . . . . . | |_._._._._._._.
  |\. . . . . | . . . . . 5 \ . . . . . | . . . . . . . |
  | \ . . . . | . ._._._._._._. . . . . | . . . . . . . |
  | .\. . . . | . | . . . . . . . . . . | . . . . . . . |
  | . .\. . . | . | . . . . . . . . . . | . . . | \ . . |
  | . . 10. . | . | . . . . . . . . . . | . . . | . 5 . |
  | . . . \ . | . | . . . . . . . . . . | . . . | . . \ |
  | . . . . \ | . | . . . . . . . . . . | ._._._| . . . .
  | . . . . .\| . | . . . . . . . . . . | | . . . . . . .
  |_._._._._._._._| . . . . . . . . . . |_| . . . . . . .
.
  . ._._._. . . . . . . . . . . . . . . . . . . . . . . . . . . .
  . | . . | . . . . . . . . . . . . . . . . . ./| . . . . . . . .
  ._| . . | . . . . . . . . . . . . . . . . ./. | . . . . . . . .
  | . . . | . . . . . . . . . . . . . . . . / . | . . . . . . . .
  | . . . | . . . . . . . . . . . . . . . ./. . | . . . . . . . .
  | . . . .\. . . . . . . . . . . . . . .10 . . | . . . . . . . .
  | . . . . . 5 . . . . . . . . . . . . / . . . | . . . . . . . .
  | . . . . . . .\. . . . . . . . . . / . . . . | . . . . . . . .
  | . . . . . . . | . . . . . . . . ./. . . . . | . . . . . . . .
  | . . . . . . . | . . . . . . . . | . . . . . |_._._._._._._._.
  | . . . . . . . | . . . . . . . . | . . . . . . . . . . . . . |
  | . . . . . . . | . . . . . . . . | . . . . . . . . . . . . . |
  | . . . . . . . | . . . . . . . . | . . . . . . . . . . . . . |
  | . . . . . . . |_._._._._._._. . | . . . . . . . . . . . . . |
  .\. . . . . . . . . . . . . . | . | . . . | \ . . . . . . . . |
  . \ . . . . . . . . . . . . . | . | . . . | . .5. . . . . . . |
  . . \ . . . . . . . . . . . . | . | . . . | . . .\._._._._._._|
  . . . \ . . . . . . . . . . . | . | ._._._| . . . . . . . . . .
  . . . 10. . . . . . . . . . . | . | | . . . . . . . . . . . . .
  . . . . \ . . . . . . . . . . | . |_| . . . . . . . . . . . . .
  . . . . . \ . . . . . . . . . |
  . . . . . .\._._._._._._._._._|
.
  . . . . . . . . . . . . . . . .
  |\. . . . . . . . . . . . . . .
  | .\. . . . . . . . . . . . . .
  | . \ . . . . . . . . . . . . .
  | . . \ . . . . . . . . . . . .
  | . . 10. . . . . . . . . . . .
  | . . . .\. . . . . . . . . . .
  | . . . . \ . . . . . . . . . .
  | . . . . . \_._._._._._._._._.
  | ._._._. . . . . . . . . . . |
  | | . . | . . . . . . . . . . |
  |_| . . | . . ./| . . . . . . |
  . . . . | . 5 . | . . . . . . |
  . . . . |/. . . | . . . . . . |
  . . . . . . . . | . . . . . . |
  . . . . . . . . | . . . . . . |
  . . . . . . . . |_._._._._._._|
. - _Hugo Pfoertner_, Mar 20 2020
		

Crossrefs

Cf. A007219.

Extensions

Typo in a(15) corrected and a(17)-a(27) added by Giovanni Resta, Mar 26 2020

A116700 "Early bird" numbers: write the natural numbers in a string 12345678910111213.... Sequence gives numbers that occur in the string ahead of their natural place, sorted into increasing order (cf. A117804).

Original entry on oeis.org

12, 21, 23, 31, 32, 34, 41, 42, 43, 45, 51, 52, 53, 54, 56, 61, 62, 63, 64, 65, 67, 71, 72, 73, 74, 75, 76, 78, 81, 82, 83, 84, 85, 86, 87, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 110, 111, 112, 121, 122, 123, 131, 132, 141, 142, 151, 152, 161, 162, 171
Offset: 1

Author

Bernardo Recamán, Jul 22 2007

Keywords

Comments

Based on an idea by Argentinian puzzle creator Jaime Poniachik, these numbers were introduced by Martin Gardner in 2005 in the magazine Math. Horizons, published by the MAA.
A048992 is a similar sequence, but is different because it does not contain 21, etc. - see comments in A048992.
A220376(n) = position of a(n) in 1234567891011121314151617181... . - Reinhard Zumkeller, Dec 13 2012

Examples

			"12" appears at the start of the string, ahead of its position after "11", so is a member.
So are 123, 23, 1234, 234, 34, ... and sorting these into increasing order we get 12, 21, 23, 31, ... - _N. J. A. Sloane_, Aug 28 2019
		

References

  • Martin Gardner, Transcendentals and early birds, Math. Horizons, XIII(2) (2005), pp. 5, 34 (published by Math. Assoc. America).

Crossrefs

Cf. A117804. A131881 gives complement.
Cf. A048991 and A048992 (Rollman numbers).
Cf. A007908 (subsequence, apart from initial 1).

Programs

  • ARIBAS
    s:= ""; for n:=1 to 200 do sn:=itoa(n);
    if substr_index(s, sn) >= 0 then write(n, ","); end;
    s:=concat(s, sn); end; (* Klaus Brockhaus, Jul 23 2007 *)
    
  • Haskell
    import Data.List (isPrefixOf, find)
    import Data.Maybe (fromJust)
    a116700 n = a116700_list !! (n-1)
    a116700_list = filter early [1 ..] where
       early z = not (reverse (show (z - 1)) `isPrefixOf` fst bird) where
          bird = fromJust $ find ((show z `isPrefixOf`) . snd) xys
       xys = iterate (\(us, v : vs) -> (v : us, vs))
                     ([], concatMap show [0 ..])
    -- Reinhard Zumkeller, Dec 13 2012
    
  • Mathematica
    s = ""; Reap[For[n=1, n <= 200, n++, sn = ToString[n]; If[StringPosition[s, sn, 1] =!= {}, Sow[n]]; s = s <> sn]][[2, 1]] (* Jean-François Alcover, Nov 04 2016, after Klaus Brockhaus *)
  • Python
    def aupto(limit):
        s, alst = "", []
        for k in range(1, limit+1):
            sk = str(k)
            if sk in s: alst.append(k)
            s += sk
        return alst
    print(aupto(171)) # Michael S. Branicky, Dec 21 2021
  • UBASIC
    10 X=""
    20 for N=1 to 396
    30 A=cutspc(str(N))
    40 if instr(X,A)>0 then print N;
    50 X+=A
    60 next N
    70 'Warut Roonguthai, Jul 23 2007
    

Formula

Asymptotically, the early bird numbers have density 1 [Golomb].

Extensions

More terms from Warut Roonguthai and Klaus Brockhaus, Jul 23 2007
Golomb links from Jeremy Gardiner, Jul 23 2007

A098891 Define the n-omino graph to be the graph whose vertices are each of the n-ominoes, two of which are joined by an edge if one can be obtained from the other by cutting out one of the latter's component squares (thus obtaining an (n-1)-omino for most cases) and gluing it elsewhere. The sequence counts the edges in these graphs.

Original entry on oeis.org

0, 0, 1, 8, 47, 266, 1339, 6544, 29837, 133495, 585002, 2542563, 10959656
Offset: 1

Author

Bernardo Recamán, Nov 08 2004

Keywords

Comments

In some cases the act of removing a component square (temporarily) disconnects the polyomino before the component is reattached elsewhere. - Sean A. Irvine, Apr 13 2020
See A367435 for the case where the cells remaining after detaching the square to be moved must be a connected polyomino. - Pontus von Brömssen, Nov 18 2023

Crossrefs

Half the row sums of A367126.
Cf. A367435.

Extensions

a(4) corrected by FUNG Cheok Yin, Feb 11 2020
a(5) corrected and a(6)-a(12) from Sean A. Irvine and Freddy Barrera, Apr 13 2020
a(13) from Pontus von Brömssen, Nov 05 2023

A048992 Hannah Rollman's numbers: the numbers excluded from A048991.

Original entry on oeis.org

12, 23, 31, 34, 41, 42, 45, 51, 52, 53, 56, 61, 62, 63, 64, 67, 71, 72, 73, 74, 75, 78, 81, 82, 83, 84, 85, 86, 89, 91, 92, 93, 94, 95, 96, 97, 98, 101, 111, 113, 121, 122, 123, 131, 141, 151, 161, 171, 181, 191, 192, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217
Offset: 1

Comments

A105390(n) = number of terms <= n; for n < 740: A105390(n) < n/2. - Reinhard Zumkeller, Apr 04 2005
A116700 is a similar sequence. Note that 21 is missing from the current sequence, because we deleted 12 in computing A048991 and now 21 is no longer "earlier in the sequence". On the other hand 21 is present in A116700. - N. J. A. Sloane, Aug 05 2007
Otherwise said: Numbers which occur in the concatenation of all smaller numbers not listed in this sequence. - M. F. Hasler, Dec 29 2012
Number of terms < 10^n, n = 1, 2, ...: (0, 37, 589, 7046, ...), gives number of n-digit terms as first differences: (37, 552, 6457, ...). - M. F. Hasler, Oct 25 2019

Crossrefs

Complement of A048991.
Similar to A116700: "early birds" in the Barbier word A007376 or Champernowne sequence A033307.

Programs

  • Haskell
    import Data.List (isInfixOf)
    a048992 n = a048992_list !! (n-1)
    a048992_list = g [1..] [] where
       g (x:xs) ys | xs' `isInfixOf` ys = x : g xs ys
                   | otherwise          = g xs (xs' ++ ys)
                   where xs' = reverse $ show x
    -- Reinhard Zumkeller, Dec 05 2011
    
  • Mathematica
    a[0] = 1; s = "1"; a[n_] := a[n] = For[k = a[n-1] + 1, True, k++, If[StringFreeQ[s, t = ToString[k]], s = s <> t, Return[k]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Nov 25 2013 *)
  • PARI
    D=[]; for(n=1, 999, for(i=0, #D-#d=digits(n), D[i+1..i+#d]!=d || print1(n",") || next(2)); D=concat(D, d)) \\ M. F. Hasler, Oct 25 2019
  • Python
    # see Hobson link
    

Extensions

Edited by Patrick De Geest, Jun 02 2003

A048991 Write down the numbers 1,2,3,... but omit any number (such as 12 or 23 or 31 ...) which appears in the concatenation of all earlier terms.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 32, 33, 35, 36, 37, 38, 39, 40, 43, 44, 46, 47, 48, 49, 50, 54, 55, 57, 58, 59, 60, 65, 66, 68, 69, 70, 76, 77, 79, 80, 87, 88, 90, 99, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112
Offset: 1

Keywords

Comments

Similar to the "punctual birds" A131881, numbers which do not occur earlier than their "natural" position in the string 123...9101112..., but more complex to compute due to the fact that here the omitted numbers must be taken into account. Contains powers of ten A011557 as a subsequence, at indices (1, 10, 63, 402, 2954, ...), giving the number of n-digit terms as (9, 53, 339, 2552, ...). - M. F. Hasler, Oct 25 2019

Examples

			12 is omitted since we see "1,2" at the beginning of the sequence; 101 is omitted because we can see "10,1[1]"; etc.
Since 12 is omitted, 21 does not occur "earlier" and it is in this sequence, but not in A131881, since it occurs earlier in "12,13". - _M. F. Hasler_, Oct 25 2019
		

References

  • Invented by 10-year-old Hannah Rollman.

Crossrefs

See A048992 for the omitted numbers.
Cf. A105390.

Programs

  • Haskell
    import Data.List (isInfixOf)
    a048991 n = a048991_list !! (n-1)
    a048991_list = f [1..] [] where
       f (x:xs) ys | xs' `isInfixOf` ys = f xs ys
                   | otherwise          = x : f xs (xs' ++ ys)
                   where xs' = reverse $ show x
    -- Reinhard Zumkeller, Dec 05 2011
    
  • Mathematica
    Clear[a]; a[1] = 1; s = "1"; a[n_] := a[n] = Catch[ For[k = a[n-1] + 1, True, k++, If[ StringFreeQ[s, t = ToString[k]], s = s <> t; Throw[k] ] ] ]; Table[a[n], {n, 1, 75}] (* Jean-François Alcover, Jan 09 2013 *)
  • PARI
    D=[]; for(n=1,199, for(i=0,#D-#d=digits(n), D[i+1..i+#d]==d && next(2)); print1(n","); D=concat(D,d)) \\ M. F. Hasler, Oct 25 2019
  • Python
    # see Hobson link
    

Extensions

Edited by Patrick De Geest, Jun 02 2003

A008336 a(n+1) = a(n)/n if n|a(n) else a(n)*n, a(1) = 1.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 20, 140, 1120, 10080, 1008, 11088, 924, 12012, 858, 12870, 205920, 3500640, 194480, 3695120, 184756, 3879876, 176358, 4056234, 97349616, 2433740400, 93605400, 2527345800, 90262350, 2617608150, 87253605, 2704861755, 86555576160, 2856334013280
Offset: 1

Keywords

Comments

The graph of log_10(a(n)+1) seems to suggest that log(a(n)) is asymptotic to C*n where C is approximately 0.8. - Daniel Forgues, Sep 18 2011
Comments from N. J. A. Sloane, Apr 14 2024: (Start)
See A370968 for the terms in increasing order with duplicates omitted.
See A337486 and A195504 for the n such that a(n+1) = a(n)/n.
Guy and Nowakowski give bounds on a(n).
Theorem: 1 is the only repeated term.
Proof: Write a(n) for A008336(n).
Suppose, seeking a contradiction, that for 1 < r < s we have a(r) = a(s).
This means that a(r)*r^e_0*(r+1)^e_1*(r+2)^e_2*...(s-1)^e_t = a(s) = a(r),
where the exponents e_* are +1 or -1. The product (P1, say) of the terms with exponent +1 must equal the product (P2, say) of the terms with exponent -1. Since r>1, we need s >= r+2.
The product P1*P2 = P1^2 of all these terms is (s-1)!/(r-1)!.
But this contradicts Erdos's theorem (Erdos 1939) that the product of two or more consecutive integers is never a square. QED.
(End)

References

  • P. Erdos, On the product of consecutive integers, J. London Math. Soc., 14 (1939), 194-198.

Crossrefs

Cf. A005132 (the original Recaman sequence).
A065422 and A260850 are variants of the present sequence.
Cf. also A195504 = Product of numbers up to n-1 used as divisors in A008336(n), n >= 2; a(1) = 1.
Cf. also A337486, A370968.

Programs

  • Haskell
    a008336 n = a008336_list !! (n-1)
    a008336_list = 1 : zipWith (/*) a008336_list [1..] where
        x /* y = if x `mod` y == 0 then x `div` y else x*y
    -- Reinhard Zumkeller, Feb 22 2012, Oct 25 2010
    
  • Maple
    A008336 := proc(n) option remember; if n = 1 then 1 elif A008336(n-1) mod (n-1) = 0 then A008336(n-1)/(n-1) else A008336(n-1)*(n-1); fi; end;
  • Mathematica
    a[n_] := a[n] = If[ Divisible[ a[n-1], n-1], a[n-1]/(n-1), a[n-1]*(n-1)]; a[1] = 1; Table[a[n], {n, 1, 28}] (* Jean-François Alcover, Dec 02 2011 *)
    nxt[{n_,a_}]:={n+1,If[Divisible[a,n],a/n,n*a]}; Transpose[ NestList[ nxt,{1,1},30]][[2]] (* Harvey P. Dale, May 09 2016 *)
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A008336(n):
        if n == 1: return 1
        a, b = divmod(c:=A008336(n-1),n-1)
        return c*(n-1) if b else a # Chai Wah Wu, Apr 11 2024