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.

A074871 Start with n and repeatedly apply the map k -> T(k) = A053837(k) + A171765(k); a(n) is the number of steps (at least one) until a prime is reached, or 0 if no prime is ever reached.

Original entry on oeis.org

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

Views

Author

Felice Russo, Sep 12 2002, Oct 11 2010

Keywords

Comments

The first occurrence of k beginning with 0: 1, 2, 17, 59, 337, 779, 16999, 6888888, ..., . - Robert G. Wilson v, Oct 20 2010

Examples

			T(2)=2. So in one step we reach a prime.
T(3)=3 and then in one step again we reach a prime.
T(4)=4 and we will never reach a prime.
T(11)=1+2=3 and again in one step we reach a prime.
T(17)=7+8=15 --> T(15)=5+6=11 and then in two steps we reach a prime.
T(13)=3+4=7 and then 1 step......
T(14)=4+5=9 --> T(9)=9 --> T(9)=9........ and we will never reach a prime.
		

Crossrefs

Cf. A053837, A171765. See A171772 for another version.

Programs

  • Mathematica
    g[n_] := Block[{id = IntegerDigits@ n}, Mod[ Plus @@ id, 10] + If[n < 10, 0, Times @@ id]]; f[n_] := Block[{lst = Rest@ NestWhileList[g, n, UnsameQ, All]}, lsp = PrimeQ@ lst; If[ Last@ Union@ lsp == False, 0, Position[lsp, True, 1, 1][[1, 1]]]]; Array[f, 105] (* Robert G. Wilson v, Oct 20 2010 *)

Extensions

Edited by N. J. A. Sloane, Oct 12 2010
More terms from Robert G. Wilson v, Oct 20 2010

A035930 Maximal product of any two numbers whose concatenation is n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 0, 10, 20, 30, 40, 50, 60, 70
Offset: 0

Views

Author

Keywords

Comments

Agrees up to a(100) = 0 with A088117, A171765 and A257297, but all of the four differ in a(101) and subsequent values. - M. F. Hasler, Sep 01 2021

Examples

			a(341) = max(34*1,3*41) = 123.
		

Crossrefs

Different from A007954, A088117, A171765 and A257297. Cf. A035931-A035935.

Programs

  • Haskell
    a035930 n | n < 10    = 0
              | otherwise = maximum $ zipWith (*)
                (map read $ init $ tail $ inits $ show n)
                (map read $ tail $ init $ tails $ show n)
    -- Reinhard Zumkeller, Aug 14 2011
    
  • Maple
    a:= proc(n) local l, m; l:= convert(n, base, 10); m:= nops(l);
          `if`(m<2, 0, max(seq(parse(cat(seq(l[m-i], i=0..j-1)))
           *parse(cat(seq(l[m-i], i=j..m-1))), j=1..m)))
        end:
    seq(a(n), n=0..120);  # Alois P. Heinz, May 22 2009
  • Mathematica
    Flatten[With[{c=Range[0,9]},Table[c*n,{n,0,10}]]] (* Harvey P. Dale, Jun 07 2012 *)
  • PARI
    apply( {A035930(n)=if(n>9,vecmax([vecprod(divrem( n,10^j))|j<-[1..logint(n,10)]]))}, [0..111]) \\ M. F. Hasler, Sep 01 2021
    
  • Python
    def a(n):
        s = str(n)
        return max((int(s[:i])*int(s[i:]) for i in range(1, len(s))), default=0)
    print([a(n) for n in range(108)]) # Michael S. Branicky, Sep 01 2021

Extensions

An erroneous formula was deleted by N. J. A. Sloane, Dec 23 2008

A257850 a(n) = floor(n/10) * (n mod 10).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 8
Offset: 0

Views

Author

M. F. Hasler, May 10 2015

Keywords

Comments

Equivalently, write n in base 10, multiply the last digit by the number with its last digit removed.
See A142150(n-1) for the base 2 analog and A257843 - A257849 for the base 3 - base 9 variants.
The first 100 terms coincide with those of A035930 (maximal product of any two numbers whose concatenation is n), A171765 (product of digits of n, or 0 for n<10), A257297 ((initial digit of n)*(n with initial digit removed)), but the sequence is of course different from each of these three.
The terms a(10) - a(100) also coincide with those of A007954 (product of decimal digits of n).

Crossrefs

Cf. A142150 (the base 2 analog), A115273, A257844 - A257849.

Programs

  • Magma
    [Floor(n/10)*(n mod 10): n in [0..100]]; // Vincenzo Librandi, May 11 2015
    
  • Mathematica
    Table[Floor[n/10] Mod[n, 10], {n, 100}] (* Vincenzo Librandi, May 11 2015 *)
  • PARI
    a(n,b=10)=(n=divrem(n,b))[1]*n[2]
    
  • Python
    def A257850(n): return n//10*(n%10) # M. F. Hasler, Sep 01 2021

Formula

a(n) = 2*a(n-10)-a(n-20). - Colin Barker, May 11 2015
G.f.: x^11*(9*x^8+8*x^7+7*x^6+6*x^5+5*x^4+4*x^3+3*x^2+2*x+1) / ((x-1)^2*(x+1)^2*(x^4-x^3+x^2-x+1)^2*(x^4+x^3+x^2+x+1)^2). - Colin Barker, May 11 2015

A088117 Let the decimal expansion of n be abcd...; then a(n) = (a*bcd... + b*acd... + c*abd... + d*abc... + ...) + (ab*cd... + bc*ad... + cd*ab... + ...) + ... . That is, a(n) = sum over all the digit strings of the product (number obtained by deleting a digit string) * (deleted digit string).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 0, 11
Offset: 0

Views

Author

Amarnath Murthy, Sep 25 2003

Keywords

Comments

Each substring is used in only product.
a(n) = 0 for 0 <= n <= 10.

Examples

			a(1234) = (1*234 + 2*134 + 3*124 + 4*123) + (12*34 + 23*14) = 2096.
a(12345) = (1*2345 + 2*1345 + 3*1245 + 4*1235 + 5*1234) + (12*345 + 15*234 + 23*145 + 34*125 + 45*123) = 40650.
		

Crossrefs

Different from A035930, A171765, A257850.

Programs

  • Maple
    a:= n-> (s-> add(add(parse(s[i..j])*parse(cat(s[1..i-1],
        s[j+1..length(s)])), i=1..j), j=1..length(s)-1))(""||n):
    seq(a(n), n=0..120);  # Alois P. Heinz, May 22 2021

Extensions

Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Jul 14 2007
a(0)=0 inserted and examples corrected by Alois P. Heinz, May 22 2021

A257297 a(n) = (initial digit of n) * (n with initial digit removed).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 0, 1, 2, 3
Offset: 0

Views

Author

M. F. Hasler, May 10 2015

Keywords

Comments

The initial 100 terms match those of A035930 (maximal product of any two numbers whose concatenation is n) and also those of A171765 (product of digits of n, or 0 for n<10), and except for initial terms, also A007954 (product of decimal digits of n) and A115300 (greatest digit of n * least digit of n).
Iterations of this map always end in 0, since a(n) < n. Sequence A257299 lists numbers for which these iterations reach 0 in exactly 9 steps, with the additional constraint of having each time a different initial digit.
If "initial" is replaced by "last" in the definition (A257850), then we get the same values up to a(100), but (10, 20, 30, ...) for n = 101, 102, 103, ..., again different from each of the 4 other sequences mentioned in the first comment. - M. F. Hasler, Sep 01 2021

Examples

			For n<10, a(n) = n*0 = 0, since removing the initial and only digit leaves nothing, i.e., zero (by convention).
a(10) = 1*0 = 0, a(12) = 1*2 = 2, ..., a(20) = 2*0 = 0, a(21) = 2*1 = 2, a(22) = 2*2 = 4, ...
a(99) = 9*9 = 81, a(100) = 1*00 = 0, a(101) = 1*01 = 1, ..., a(123) = 1*23, ...
		

Crossrefs

Programs

  • Maple
    a:= n-> `if`(n<10, 0, (s-> parse(s[1])*parse(s[2..-1]))(""||n)):
    seq(a(n), n=0..120);  # Alois P. Heinz, Feb 12 2024
  • Mathematica
    Table[Times@@FromDigits/@TakeDrop[IntegerDigits@n,1],{n,0,103}] (* Giorgos Kalogeropoulos, Sep 03 2021 *)
  • PARI
    apply( {A257297(n)=vecprod(divrem(n,10^logint(n+!n,10)))}, [0..111]) \\ Edited by M. F. Hasler, Sep 01 2021
    
  • Python
    def a(n): s = str(n); return 0 if len(s) < 2 else int(s[0])*int(s[1:])
    print([a(n) for n in range(104)]) # Michael S. Branicky, Sep 01 2021

Formula

For 1 <= m <= 9 and n < 10^k, a(m*10^k + n) = m*n.

Extensions

a(101..103) corrected by M. F. Hasler, Sep 01 2021

A330633 The concatenation of the products of every pair of consecutive digits of n (with a(n) = 0 for 0 <= n <= 9).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0
Offset: 0

Views

Author

Scott R. Shannon, Dec 21 2019

Keywords

Comments

If the decimal expansion of n is d_1 d_2 ... d_k then a(n) is the number formed by concatenating the decimal numbers d_1*d_2, d_2*d_3, ..., d_{k-1}*d_k.
Due to the fact that for two digit numbers the sequence is simply the multiplication of those two numbers, this sequence matches numerous others for the first 100 terms. See the sequences in the cross references. The terms begin to differ beyond n = 100.

Crossrefs

Programs

  • Maple
    read("transforms") :
    A330633 := proc(n)
        local dgs,L,i ;
        if n <=9 then
            0;
        else
            dgs := ListTools[Reverse](convert(n,base,10)) ;
            L := [] ;
            for i from 2 to nops(dgs) do
                L := [op(L), op(i-1,dgs)*op(i,dgs)] ;
            end do:
            digcatL(L) ;
        end if;
    end proc: # R. J. Mathar, Jan 11 2020
  • Mathematica
    Array[If[Or[# == 0, IntegerLength@ # == 1], 0, FromDigits[Join @@ IntegerDigits[Times @@ # & /@ Partition[IntegerDigits@ #, 2, 1]]]] &, 81, 0] (* Michael De Vlieger, Dec 23 2019 *)
  • PARI
    a(n) = my(d=digits(n), s="0"); for (k=1, #d-1, s=concat(s, d[k]*d[k+1])); eval(s); \\ Michel Marcus, Apr 28 2020

Formula

a(10) = 0 as 1 * 0 = 0.
a(29) = 18 as 2 * 9 = 18.
a(100) = 0 as 1 * 0 = 0 and 0 = 0 = 0, and '00' is reduced to 0.
a(110) = 10 as 1 * 1 = 1 and 1 * 0 = 0. This is the first term that differs from A007954 and A171765, the multiplication of all digits of n.

A172054 n-th number k such that 6*k-1 is composite while 6*k+1 is prime minus n-th number m such that 6*m-1 is prime while 6*m+1 is composite.

Original entry on oeis.org

2, 3, 4, 2, 6, 7, 5, 7, 8, 7, 9, 12, 12, 12, 9, 4, 6, 4, 8, 9, 7, 8, 12, 11, 14, 17, 17, 12, 18, 17, 19, 13, 13, 10, 11, 9, 8, 7, 15, 17, 18, 13, 12, 13, 13, 11, 11, 15, 19, 19, 23, 23, 19, 12, 16, 17, 12, 11, 18, 22, 27, 29, 27, 27, 25, 18, 27, 28, 23, 22, 23, 17, 21, 24, 23, 23, 30
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Jan 24 2010

Keywords

Comments

Are there negative terms?
The entries are positive for at least the first 250000 terms. - R. J. Mathar, May 22 2010

Examples

			The number 6 is the first integer k such that 6*k-1 is composite while 6*k+1 is prime, the number 4 is the first integer m such that 6*m -1 is prime while 6*m+1 is composite, so, 2 = 6 - 4 is the first term a(1) of this sequence. - _Bernard Schott_, Feb 18 2019
		

Crossrefs

Programs

  • GAP
    L:=500;;
    K:=Filtered([1..L],k-> not IsPrime(6*k-1) and IsPrime(6*k+1));;
    M:=Filtered([1..L],m-> not IsPrime(6*m+1) and IsPrime(6*m-1));;
    a:=List([1..Length(K)],i->K[i]-M[i]);; Print(a); # Muniru A Asiru, Feb 19 2019
    
  • Magma
    A121765:=[n: n in [1..350] | not IsPrime(6*n-1) and  IsPrime(6*n+1)];
    A121763:=[n: n in [1..350] | IsPrime(6*n-1) and not IsPrime(6*n+1)];
    [A121765[n] - A121763[n]: n in [1..80]]; // G. C. Greubel, Feb 20 2019
    
  • Maple
    A121765 := proc(n) option remember; if n = 1 then 6; else for a from procname(n-1)+1 do if 6*a-1 >=4 and not isprime(6*a-1) and isprime(6*a+1) then return a; end if; end do; end if; end proc:
    A121763 := proc(n) option remember; if n = 1 then 4; else for a from procname(n-1)+1 do if 6*a+1 >=4 and not isprime(6*a+1) and isprime(6*a-1) then return a; end if; end do; end if; end proc:
    A172054 := proc(n) A121765(n)-A121763(n) ; end proc:
    seq(A172054(n),n=1..120) ; # R. J. Mathar, May 22 2010
  • Mathematica
    A121765:= Select[Range[350], !PrimeQ[6#-1] && PrimeQ[6#+1] &];
    A121763:= Select[Range[350], PrimeQ[6#-1] && !PrimeQ[6#+1] &];
    Table[A121765[[n]] - A121763[[n]], {n, 1, 80}] (* G. C. Greubel, Feb 20 2019 *)
  • Sage
    A121765=[n for n in (1..350) if not is_prime(6*n-1) and is_prime(6*n+1)];
    A121763=[n for n in (1..350) if is_prime(6*n-1) and not is_prime(6*n+1)];
    [A121765[n] - A121763[n] for n in (0..80)] # G. C. Greubel, Feb 20 2019

Formula

a(n) = A121765(n) - A121763(n).

Extensions

Entries checked by R. J. Mathar, May 22 2010

A347470 Least product of any two numbers whose concatenation is n, excluding 0*n for n > 9.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 0, 11, 12
Offset: 0

Views

Author

M. F. Hasler, Sep 03 2021

Keywords

Comments

Leading zeros are not allowed: e.g., 101 = concat(10,1) but not concat(1,01). Although 0 is a valid number, we don't allow the trivial decomposition n = concat(0, n) except for the single-digit n < 10, otherwise the minimal product would always be 0.
For n < 111, this sequence coincides with A035930 (same with "largest"), because there is only one possible concatenation, but it differs for n > 111, cf. examples.

Examples

			The number n = 112 is the concatenation of 1 and 12, or of 11 and 2, with respective products 1*12 = 12 and 11*2 = 22. Hence, a(112) = 12, while A035930(112) = 22.
		

Crossrefs

Programs

  • PARI
    apply( {A347470(x,t(b,c)=if(c\10<=b%c,b\c*(b%c),c>10,oo))= if(x>9,vecmin(vector(logint(x,10),j,t(x,10^j))))}, [0..112])

A172055 n-th number k such that 6*k-1 is composite while 6*k+1 is prime plus n-th number m such that 6*m-1 is prime while 6*m+1 is composite.

Original entry on oeis.org

10, 19, 22, 30, 36, 45, 49, 63, 66, 85, 93, 98, 100, 110, 115, 122, 126, 132, 138, 143, 155, 158, 168, 171, 178, 185, 187, 198, 206, 213, 217, 229, 231, 236, 239, 243, 248, 255, 269, 275, 284, 293, 300, 309, 317, 321, 325, 331, 337, 343, 349, 351, 357, 378
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Jan 24 2010

Keywords

Crossrefs

Programs

  • GAP
    A121765:=Filtered([1..350],k-> not IsPrime(6*k-1) and IsPrime(6*k+1));;
    A121763:=Filtered([1..350],n-> not IsPrime(6*n+1) and IsPrime(6*n-1));;
    Print(List([1..80],j->A121765[j]+A121763[j])); # G. C. Greubel, Feb 20 2019
  • Magma
    A121765:=[n: n in [1..350] | not IsPrime(6*n-1) and  IsPrime(6*n+1)];
    A121763:=[n: n in [1..350] | IsPrime(6*n-1) and not IsPrime(6*n+1)];
    [A121765[n] + A121763[n]: n in [1..80]]; // G. C. Greubel, Feb 20 2019
    
  • Maple
    A121765:=select(k->not isprime(6*k-1) and isprime(6*k+1),[$1..350]):
    A121763:=select(n->not isprime(6*n+1) and isprime(6*n-1),[$1..350]):
    seq(A121765[m]+A121763[m],m=1..60); # Muniru A Asiru, Feb 21 2019
  • Mathematica
    A121765:= Select[Range[350], !PrimeQ[6#-1] && PrimeQ[6#+1] &];
    A121763:= Select[Range[350], PrimeQ[6#-1] && !PrimeQ[6#+1] &];
    Table[A121765[[n]] + A121763[[n]], {n, 1, 80}] (* G. C. Greubel, Feb 20 2019 *)
  • Sage
    A121765=[n for n in (1..350) if not is_prime(6*n-1) and is_prime(6*n+1)];
    A121763=[n for n in (1..350) if is_prime(6*n-1) and not is_prime(6*n+1)];
    [A121765[n] + A121763[n] for n in (0..80)] # G. C. Greubel, Feb 20 2019
    

Formula

a(n) = A121765(n) + A121763(n).

Extensions

Entries checked by R. J. Mathar, May 22 2010
Showing 1-9 of 9 results.