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: Maghraoui Abdelkader

Maghraoui Abdelkader's wiki page.

Maghraoui Abdelkader has authored 11 sequences. Here are the ten most recent ones:

A262254 a(1) = 11; for n>1, a(n) is the smallest prime that starts with the least significant digit of the previous term and has not occurred earlier.

Original entry on oeis.org

11, 13, 31, 17, 71, 19, 97, 73, 37, 79, 907, 701, 101, 103, 307, 709, 911, 107, 719, 919, 929, 937, 727, 733, 311, 109, 941, 113, 313, 317, 739, 947, 743, 331, 127, 751, 131, 137, 757, 761, 139, 953, 337, 769, 967, 773, 347, 787, 797, 7001, 149, 971, 151, 157, 7013, 349, 977, 7019, 983
Offset: 1

Author

Maghraoui Abdelkader, Sep 16 2015

Keywords

Comments

This sequence is different from A089755, as this one does not include single-digit primes.
This sequence is different from A089755, for which a(n+1) uses all the digit of a(n) except the most-significant digit of a(n).
In this sequence, a(n+1) uses only the least-significant digit of a(n).

Examples

			a(3) = 31 where the most significant digit of 31 is 3, which is the least significant digit of a(2) = 13.
		

Crossrefs

Programs

  • Mathematica
    f[s_List] := Block[{lsd = Mod[s[[-1]], 10], p = 3}, While[ IntegerDigits[p][[1]] != lsd || MemberQ[s, p], p = NextPrime@ p]; Append[s, p]]; s = {11}; s = Nest[f, s, 70] (* Robert G. Wilson v, Sep 16 2015 *)
  • PARI
    msd(n)=(n\10^(#Str(n)-1)); l1=1;l3=1;l7=1;l9=1; q=1; lsd(n)=n%10;
    t1 = vector(200); i=1;forprime(n=11,10000, if( digits(n)[1]==1,t1[i]=n; i=i+1 ; )) ;
    t3 = vector(130); i=1;forprime(n=31,3900 ,  if( digits(n)[1]==3,t3[i]=n; i=i+1 ; ));
    t7 = vector(130); i=1;forprime(n=71,70000, if( digits(n)[1]==7,t7[i]=n; i=i+1 ; )) ;
    t9 = vector(130); i=1;forprime(n=97,90000, if( digits(n)[1]==9,t9[i]=n; i=i+1 ; )) ;lsd(n)=n%10;
    t = vector(200);
    findnextnumber(m) =
    {if(lsd(m)==1, l1=t1[i1] ; i1=i1+1;return(l1);); if(lsd(m)==3, l3=t3[i3];  i3=i3+1 ; return(l3););
    if(lsd(m)==7, l7=t7[i7] ; i7=i7+1;return(l7);); if(lsd(m)==9, l9=t9[i9];  i9=i9+1;return(l9);); }
    i1=1;  i3=1;  i7=1;  i9=1;  j=1;s=11;   for(n=1,200,   p=findnextnumber(s) ; t[j]=p; s=p;j++);for(i=1,200, print1(t[i],", ") )

A261507 Fibonacci-numbered rows of Pascal's triangle. Triangle read by rows: T(n,k)= binomial(Fibonacci(n), k).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 5, 10, 10, 5, 1, 1, 8, 28, 56, 70, 56, 28, 8, 1, 1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1, 1, 21, 210, 1330, 5985, 20349, 54264, 116280, 203490, 293930, 352716, 352716, 293930, 203490, 116280, 54264, 20349, 5985, 1330, 210, 21, 1
Offset: 0

Author

Maghraoui Abdelkader, Aug 22 2015

Keywords

Comments

Subsequence of A007318.

Examples

			1,
1,  1,
1,  1,
1,  2,  1,
1,  3,  3,   1,
1,  5, 10,  10,   5,    1,
1,  8, 28,  56,  70,   56,   28,    8,    1,
1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1
		

Programs

  • Mathematica
    Table[Binomial[Fibonacci[n], k], {n, 0, 8}, {k, 0, Fibonacci[n]}]//Flatten (* Jean-François Alcover, Nov 12 2015*)
  • PARI
    v = vector(101,j,fibonacci(j)); i=0; n=0; while(n<100, for(k=0, n, print1(binomial(n, k), ", ","")); print(); i=i+1; n=v[i] ;)

Formula

T(n, k) = binomial(fibonacci(n), k).
T(n, 1) = fibonacci(n) = A000045(n).
T(n, 2) = A191797(n) for n>3.

A262463 If n is prime a(n) = n else a(n) = nextprime(reverse(n)), where "next prime" is the smallest prime >= n, see A007918.

Original entry on oeis.org

2, 2, 3, 5, 5, 7, 7, 11, 11, 2, 11, 23, 13, 41, 53, 61, 17, 83, 19, 2, 13, 23, 23, 43, 53, 67, 73, 83, 29, 3, 31, 23, 37, 43, 53, 67, 37, 83, 97, 5, 41, 29, 43, 47, 59, 67, 47, 89, 97, 5, 17, 29, 53, 47, 59, 67, 79, 89, 59, 7, 61, 29, 37, 47, 59, 67, 67, 89, 97, 7, 71, 29, 73, 47, 59, 67, 79, 89, 79, 11, 19, 29
Offset: 1

Author

Maghraoui Abdelkader, Sep 23 2015

Keywords

Examples

			For n=7 a(7)=7.
For n=12, reverse(12)=21; a(12)=nextprime(21)=23.
		

Crossrefs

Programs

  • Mathematica
    Table[Which[PrimeQ[n],n,PrimeQ[IntegerReverse[n]],IntegerReverse[n], True, NextPrime[ IntegerReverse[ n]]],{n,100}] (* Harvey P. Dale, May 12 2018 *)
  • PARI
    rev(n)={d=digits(n); p=""; for(i=1, #d, p=concat(Str(d[i]), p)); return(eval(p))}
    i=0; t=vector(200);
    findn(n)={if(isprime(n),t[i++]=n, a=rev(n); b=nextprime(a); t[i++]=b); }
    for(n=1,200,findn(n)); t

Formula

a(n)=n if n is prime;
else b=reverse(n);
if b is prime a(n)=b else a(n)=nextprime(b);
(using "next prime" function as "smallest prime >= n"; see A007918. )

A261198 Start with n and repeat the map x -> x+sumdigits(x) until reaching a prime, which is a(n), or 0 if no prime is reached.

Original entry on oeis.org

2, 23, 0, 23, 11, 0, 19, 23, 0, 11, 13, 0, 17, 19, 0, 23, 37, 0, 29, 41, 0, 41, 101, 0, 37, 41, 0, 101, 59, 0, 43, 37, 0, 41, 43, 0, 47, 101, 0, 59, 67, 0, 89, 59, 0, 67, 71, 0, 101, 89, 0, 59, 61, 0, 89, 67, 0, 71, 73, 0, 103, 101, 0, 127, 89, 0, 109, 103, 0, 101, 79, 0, 83, 127, 0, 89, 101, 0, 109, 109, 0, 103, 107, 0, 127, 101, 0, 109, 113, 0, 101, 103, 0, 107, 109, 0, 113, 127, 0, 101
Offset: 1

Author

Maghraoui Abdelkader, Sep 30 2015

Keywords

Comments

Multiples of 3 never reach a prime because (3*x + sumdigits(3*x)) is always a multiple of 3.

Examples

			a(3)=0; a(6)=0; a(9)=0  as 3,6,9 are multiples of 3.
n=2; a0=2; a1=2+sumdigits(2)=4; a2=4+sumdigits(4)=8; a3=8+sumdigits(8)=16;
a4=16+sumdigits(16)=16+7=23; a4 is prime, so a(2)=23;
a(14)=14+(1+4=19); 19 is prime.
a(16)=16+(1+6)=23; 23 is prime.
		

Crossrefs

Programs

  • PARI
    verif(n)={if((n%3)==0, print1(0,", ");return(););
    b=1; a=n;
    while(b<10, a=a+sumdigits(a) ;if(isprime(a),print1(a,", "); b=20))}
    for(n=1, 100, verif(n);)

A261365 Prime-numbered rows of Pascal's triangle.

Original entry on oeis.org

1, 2, 1, 1, 3, 3, 1, 1, 5, 10, 10, 5, 1, 1, 7, 21, 35, 35, 21, 7, 1, 1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1, 1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1, 1, 17, 136, 680, 2380, 6188, 12376, 19448, 24310, 24310, 19448, 12376, 6188, 2380, 680, 136, 17, 1, 1, 19, 171, 969, 3876, 11628, 27132, 50388, 75582, 92378, 92378, 75582, 50388, 27132, 11628, 3876, 969, 171, 19, 1
Offset: 1

Author

Maghraoui Abdelkader, Aug 16 2015

Keywords

Examples

			1,2,1;
1,3,3,1;
1,5,10,10,5,1;
1,7,21,35,35,21,7,1;
1,11,55,165,330,462,462,330,165,55,11,1;
		

Crossrefs

Cf. A000040 (2nd column), A008837 (3rd column).

Programs

  • Mathematica
    Table[Binomial[Prime@ n, k], {n, 8}, {k, 0, Prime@ n}] // Flatten (* Michael De Vlieger, Aug 20 2015 *)
  • PARI
    forprime(n=2, 20, for(k=0,n,print1(binomial(n,k),", ")))

Formula

T(n,k) = binomial(prime(n), k).

A030657 Parity of digits of Pi.

Original entry on oeis.org

1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1
Offset: 1

Keywords

Crossrefs

Programs

  • Mathematica
    s = First[RealDigits[N[Pi, 1000]]]; aa = {}; Do[If[OddQ[s[[n]]], AppendTo[aa, 1], AppendTo[aa, 0]], {n, 1, Length[s]}]; aa (* Artur Jasinski, Mar 05 2010 *)
    s= RealDigits[N[Pi, 10000]][[1]];Table[{n,Mod[s[[n]],2]},{n,10000}](* this gives b-file *)(* Zak Seidov, Oct 05 2011*)

Formula

a(n) = A000035(A000796(n)). - Omar E. Pol, Oct 26 2013

Extensions

More terms from Simon Plouffe.

A030656 Pair up the numbers.

Original entry on oeis.org

1, 23, 45, 67, 89, 1011, 1213, 1415, 1617, 1819, 2021, 2223, 2425, 2627, 2829, 3031, 3233, 3435, 3637, 3839, 4041, 4243, 4445, 4647, 4849, 5051, 5253, 5455, 5657, 5859, 6061, 6263, 6465, 6667, 6869, 7071, 7273, 7475, 7677, 7879, 8081, 8283, 8485, 8687, 8889
Offset: 0

Keywords

Crossrefs

Cf. A030655.
Subsequence of A005408.

Programs

  • Magma
    [Seqint(Intseq(n+1) cat Intseq(n)): n in [0..86 by 2]];  // Bruno Berselli, Jun 18 2011
    
  • Mathematica
    seq[n_] := FromDigits[Flatten[IntegerDigits /@ #]] & /@ Partition[Range[0, (n + 1)*2], 2];
    seq[44] (* Harvey P. Dale, Jan 24 2012, edited by Robert P. P. McKone, Jan 23 2021 *)
  • PARI
    a(n)=eval(Str(2*n,2*n+1)) \\ Charles R Greathouse IV, Jul 21 2016
    
  • Python
    def a(n): return int(str(2*n)+str(2*n+1))
    print([a(n) for n in range(45)]) # Michael S. Branicky, Jan 23 2021

Extensions

More terms from Erich Friedman

A030658 1 iff n-th digit of Pi is >= (n+1)st digit.

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0
Offset: 1

Keywords

Comments

a(n) = if A095916(n) <= 0 then 1 else 0. - Reinhard Zumkeller, Mar 12 2015

Crossrefs

Programs

  • Haskell
    a030658 = fromEnum . (<= 0) . a095916  -- Reinhard Zumkeller, Mar 12 2015
    
  • Mathematica
    If[First[#]>=Last[#],1,0]&/@Partition[RealDigits[Pi,10,130][[1]],2,1] (* Harvey P. Dale, Jul 25 2011 *)
  • Python
    import sympy as sp
    length = 100
    [int(x>=y) for l in [str(sp.N(sp.pi/10,length))[2:]] for x,y in zip(l[:-1],l[1:])]
    # Nicholas Stefan Georgescu, Feb 27 2023

Extensions

More terms from David Radcliffe

A027746 Irregular triangle in which first row is 1, n-th row (n>1) gives prime factors of n with repetition.

Original entry on oeis.org

1, 2, 3, 2, 2, 5, 2, 3, 7, 2, 2, 2, 3, 3, 2, 5, 11, 2, 2, 3, 13, 2, 7, 3, 5, 2, 2, 2, 2, 17, 2, 3, 3, 19, 2, 2, 5, 3, 7, 2, 11, 23, 2, 2, 2, 3, 5, 5, 2, 13, 3, 3, 3, 2, 2, 7, 29, 2, 3, 5, 31, 2, 2, 2, 2, 2, 3, 11, 2, 17, 5, 7, 2, 2, 3, 3, 37, 2, 19, 3, 13, 2, 2, 2, 5, 41, 2, 3, 7, 43, 2, 2, 11, 3, 3, 5
Offset: 1

Keywords

Comments

n-th row has length A001222(n) (n>1).

Examples

			Triangle begins
  1;
  2;
  3;
  2, 2;
  5;
  2, 3;
  7;
  2, 2, 2;
  3, 3;
  2, 5;
  11;
  2, 2, 3;
  ...
		

Crossrefs

a(A022559(A000040(n))+1) = A000040(n).
Column 1 is A020639, columns 2 and 3 correspond to A014673 and A115561.
A281890 measures frequency of each prime in each column, with A281889 giving median values.
Cf. A175943 (partial products), A265110 (partial row products), A265111.

Programs

  • Haskell
    import Data.List (unfoldr)
    a027746 n k = a027746_tabl !! (n-1) !! (k-1)
    a027746_tabl = map a027746_row [1..]
    a027746_row 1 = [1]
    a027746_row n = unfoldr fact n where
       fact 1 = Nothing
       fact x = Just (p, x `div` p) where p = a020639 x
    -- Reinhard Zumkeller, Aug 27 2011
    
  • Maple
    P:=proc(n) local FM: FM:=ifactors(n)[2]: seq(seq(FM[j][1],k=1..FM[j][2]),j=1..nops(FM)) end: 1; for n from 2 to 45 do P(n) od; # yields sequence in triangular form; Emeric Deutsch, Feb 13 2005
  • Mathematica
    row[n_] := Flatten[ Table[#[[1]], {#[[2]]}] & /@ FactorInteger[n]]; Flatten[ Table[ row[n], {n, 1, 45}]] (* Jean-François Alcover, Dec 01 2011 *)
  • PARI
    A027746_row(n,o=[1])=if(n>1,concat(apply(t->vector(t[2],i,t[1]), Vec(factor(n)~))),o) \\ Use %(n,[]) if you want the more natural [] for the first row. - M. F. Hasler, Jul 29 2015
    
  • Python
    def factors(n: int) -> list[int]:
        p = n
        L:list[int] = []
        for f in range(2, p + 1):
            if f * f > p: break
            while True:
                q, r = divmod(p, f)
                if r != 0: break
                L.append(f)
                p = q
                if p == 1: return L
        L.append(p)
        return L  # Peter Luschny, Jul 18 2024
  • Sage
    v=[1]
    for k in [2..45]: v.extend(p for (p, m) in factor(k) for _ in range(m))
    print(v) # Giuseppe Coppoletta, Dec 29 2017
    

Formula

Product_{k=1..A001222(n)} T(n,k) = n.
From Reinhard Zumkeller, Aug 27 2011: (Start)
A001414(n) = Sum_{k=1..A001222(n)} T(n,k), n>1;
A006530(n) = T(n,A001222(n)) = Max_{k=1..A001222(n)} T(n,k);
A020639(n) = T(n,1) = Min_{k=1..A001222(n)} T(n,k). (End)

Extensions

More terms from James Sellers

A036467 a(n) + a(n-1) = n-th prime.

Original entry on oeis.org

1, 1, 2, 3, 4, 7, 6, 11, 8, 15, 14, 17, 20, 21, 22, 25, 28, 31, 30, 37, 34, 39, 40, 43, 46, 51, 50, 53, 54, 55, 58, 69, 62, 75, 64, 85, 66, 91, 72, 95, 78, 101, 80, 111, 82, 115, 84, 127, 96, 131, 98, 135, 104, 137, 114, 143, 120, 149, 122, 155, 126, 157, 136, 171, 140, 173
Offset: 0

Keywords

Comments

After the initial 1,1, this sequence contains no duplicate values: terms thereafter have opposite parity, and a(n+2) > a(n). Do even and odd values trade the lead infinitely often? (We would expect them to if we model their difference as a random walk.) - Franklin T. Adams-Watters, Jan 25 2010

Crossrefs

Programs

  • Haskell
    a036467 n = a036467_list !! n
    a036467_list = 1 : zipWith (-) a000040_list a036467_list
    -- Reinhard Zumkeller, Nov 02 2011
  • Magma
    [n lt 2 select 1 else NthPrime(n)-NthPrime(n-1)+Self(n-1): n in [0..65]];  // Bruno Berselli, Jun 18 2011
    
  • Mathematica
    a[n_] := Abs[1+Sum[(-1)^(k+1)*Prime[k], {k, 2, n}]]; a /@ Range[0, 65] (* Jean-François Alcover, Apr 22 2011 *)
    t={1,1};Do[AppendTo[t,NextPrime[t[[-2]]+t[[-1]]]-t[[-1]]],{n,64}];t (* Vladimir Joseph Stephan Orlovsky, Jan 26 2012 *)
    Transpose[NestList[{First[#]+1,Prime[First[#]+1]-Last[#]}&,{0,1},70]][[2]] (* Harvey P. Dale, Sep 14 2012 *)
  • PARI
    print1(t=1);forprime(p=2,1e3,print1(", ",t=p-t)) \\ Charles R Greathouse IV, Jun 18 2011
    

Extensions

More terms from Jud McCranie