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.

A000295 Eulerian numbers (Euler's triangle: column k=2 of A008292, column k=1 of A173018).

Original entry on oeis.org

0, 0, 1, 4, 11, 26, 57, 120, 247, 502, 1013, 2036, 4083, 8178, 16369, 32752, 65519, 131054, 262125, 524268, 1048555, 2097130, 4194281, 8388584, 16777191, 33554406, 67108837, 134217700, 268435427, 536870882, 1073741793, 2147483616, 4294967263, 8589934558
Offset: 0

Views

Author

Keywords

Comments

There are 2 versions of Euler's triangle:
* A008292 Classic version of Euler's triangle used by Comtet (1974).
* A173018 Version of Euler's triangle used by Graham, Knuth and Patashnik in Concrete Math. (1990).
Euler's triangle rows and columns indexing conventions:
* A008292 The rows and columns of the Eulerian triangle are both indexed starting from 1. (Classic version: used in the classic books by Riordan and Comtet.)
* A173018 The rows and columns of the Eulerian triangle are both indexed starting from 0. (Graham et al.)
Number of Dyck paths of semilength n having exactly one long ascent (i.e., ascent of length at least two). Example: a(4)=11 because among the 14 Dyck paths of semilength 4, the paths that do not have exactly one long ascent are UDUDUDUD (no long ascent), UUDDUUDD and UUDUUDDD (two long ascents). Here U=(1,1) and D=(1,-1). Also number of ordered trees with n edges having exactly one branch node (i.e., vertex of outdegree at least two). - Emeric Deutsch, Feb 22 2004
Number of permutations of {1,2,...,n} with exactly one descent (i.e., permutations (p(1),p(2),...,p(n)) such that #{i: p(i)>p(i+1)}=1). E.g., a(3)=4 because the permutations of {1,2,3} with one descent are 132, 213, 231 and 312.
a(n+1) is the convolution of nonnegative integers (A001477) and powers of two (A000079). - Graeme McRae, Jun 07 2006
Partial sum of main diagonal of A125127. - Jonathan Vos Post, Nov 22 2006
Number of partitions of an n-set having exactly one block of size > 1. Example: a(4)=11 because, if the partitioned set is {1,2,3,4}, then we have 1234, 123|4, 124|3, 134|2, 1|234, 12|3|4, 13|2|4, 14|2|3, 1|23|4, 1|24|3 and 1|2|34. - Emeric Deutsch, Oct 28 2006
k divides a(k+1) for k in A014741. - Alexander Adamchuk, Nov 03 2006
(Number of permutations avoiding patterns 321, 2413, 3412, 21534) minus one. - Jean-Luc Baril, Nov 01 2007, Mar 21 2008
The chromatic invariant of the prism graph P_n for n >= 3. - Jonathan Vos Post, Aug 29 2008
Decimal integer corresponding to the result of XORing the binary representation of 2^n - 1 and the binary representation of n with leading zeros. This sequence and a few others are syntactically similar. For n > 0, let D(n) denote the decimal integer corresponding to the binary number having n consecutive 1's. Then D(n).OP.n represents the n-th term of a sequence when .OP. stands for a binary operator such as '+', '-', '*', 'quotentof', 'mod', 'choose'. We then get the various sequences A136556, A082495, A082482, A066524, A000295, A052944. Another syntactically similar sequence results when we take the n-th term as f(D(n)).OP.f(n). For example if f='factorial' and .OP.='/', we get (A136556)(A000295) ; if f='squaring' and .OP.='-', we get (A000295)(A052944). - K.V.Iyer, Mar 30 2009
Chromatic invariant of the prism graph Y_n.
Number of labelings of a full binary tree of height n-1, such that each path from root to any leaf contains each label from {1,2,...,n-1} exactly once. - Michael Vielhaber (vielhaber(AT)gmail.com), Nov 18 2009
Also number of nontrivial equivalence classes generated by the weak associative law X((YZ)T)=(X(YZ))T on words with n open and n closed parentheses. Also the number of join (resp. meet)-irreducible elements in the pruning-grafting lattice of binary trees with n leaves. - Jean Pallo, Jan 08 2010
Nonzero terms of this sequence can be found from the row sums of the third sub-triangle extracted from Pascal's triangle as indicated below by braces:
1;
1, 1;
{1}, 2, 1;
{1, 3}, 3, 1;
{1, 4, 6}, 4, 1;
{1, 5, 10, 10}, 5, 1;
{1, 6, 15, 20, 15}, 6, 1;
... - L. Edson Jeffery, Dec 28 2011
For integers a, b, denote by a<+>b the least c >= a, such that the Hamming distance D(a,c) = b (note that, generally speaking, a<+>b differs from b<+>a). Then for n >= 3, a(n) = n<+>n. This has a simple explanation: for n >= 3 in binary we have a(n) = (2^n-1)-n = "anti n". - Vladimir Shevelev, Feb 14 2012
a(n) is the number of binary sequences of length n having at least one pair 01. - Branko Curgus, May 23 2012
Nonzero terms are those integers k for which there exists a perfect (Hamming) error-correcting code. - L. Edson Jeffery, Nov 28 2012
a(n) is the number of length n binary words constructed in the following manner: Select two positions in which to place the first two 0's of the word. Fill in all (possibly none) of the positions before the second 0 with 1's and then complete the word with an arbitrary string of 0's or 1's. So a(n) = Sum_{k=2..n} (k-1)*2^(n-k). - Geoffrey Critzer, Dec 12 2013
Without first 0: a(n)/2^n equals Sum_{k=0..n} k/2^k. For example: a(5)=57, 57/32 = 0/1 + 1/2 + 2/4 + 3/8 + 4/16 + 5/32. - Bob Selcoe, Feb 25 2014
The first barycentric coordinate of the centroid of the first n rows of Pascal's triangle, assuming the numbers are weights, is A000295(n+1)/A000337(n). See attached figure. - César Eliud Lozada, Nov 14 2014
Starting (0, 1, 4, 11, ...), this is the binomial transform of (0, 1, 2, 2, 2, ...). - Gary W. Adamson, Jul 27 2015
Also the number of (non-null) connected induced subgraphs in the n-triangular honeycomb rook graph. - Eric W. Weisstein, Aug 27 2017
a(n) is the number of swaps needed in the worst case to transform a binary tree with n full levels into a heap, using (bottom-up) heapify. - Rudy van Vliet, Sep 19 2017
The utility of large networks, particularly social networks, with n participants is given by the terms a(n) of this sequence. This assertion is known as Reed's Law, see the Wikipedia link. - Johannes W. Meijer, Jun 03 2019
a(n-1) is the number of subsets of {1..n} in which the largest element of the set exceeds by at least 2 the next largest element. For example, for n = 5, a(4) = 11 and the 11 sets are {1,3}, {1,4}, {1,5}, {2,4}, {2,5}, {3,5}, {1,2,4}, {1,2,5}, {1,3,5}, {2,3,5}, {1,2,3,5}. - Enrique Navarrete, Apr 08 2020
a(n-1) is also the number of subsets of {1..n} in which the second smallest element of the set exceeds by at least 2 the smallest element. For example, for n = 5, a(4) = 11 and the 11 sets are {1,3}, {1,4}, {1,5}, {2,4}, {2,5}, {3,5}, {1,3,4}, {1,3,5}, {1,4,5}, {2,4,5}, {1,3,4,5}. - Enrique Navarrete, Apr 09 2020
a(n+1) is the sum of the smallest elements of all subsets of {1..n}. For example, for n=3, a(4)=11; the subsets of {1,2,3} are {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}, and the sum of smallest elements is 11. - Enrique Navarrete, Aug 20 2020
Number of subsets of an n-set that have more than one element. - Eric M. Schmidt, Mar 13 2021
Number of individual bets in a "full cover" bet on n-1 horses, dogs, etc. in different races. Each horse, etc. can be bet on or not, giving 2^n bets. But, by convention, singles (a bet on only one race) are not included, reducing the total number bets by n. It is also impossible to bet on no horses at all, reducing the number of bets by another 1. A full cover on 4 horses, dogs, etc. is therefore 6 doubles, 4 trebles and 1 four-horse etc. accumulator. In British betting, such a bet on 4 horses etc. is a Yankee; on 5, a super-Yankee. - Paul Duckett, Nov 17 2021
From Enrique Navarrete, May 25 2022: (Start)
Number of binary sequences of length n with at least two 1's.
a(n-1) is the number of ways to choose an odd number of elements greater than or equal to 3 out of n elements.
a(n+1) is the number of ways to split [n] = {1,2,...,n} into two (possibly empty) complementary intervals {1,2,...,i} and {i+1,i+2,...,n} and then select a subset from the first interval (2^i choices, 0 <= i <= n), and one block/cell (i.e., subinterval) from the second interval (n-i choices, 0 <= i <= n).
(End)
Number of possible conjunctions in a system of n planets; for example, there can be 0 conjunctions with one planet, one with two planets, four with three planets (three pairs of planets plus one with all three) and so on. - Wendy Appleby, Jan 02 2023
Largest exponent m such that 2^m divides (2^n-1)!. - Franz Vrabec, Aug 18 2023
It seems that a(n-1) is the number of odd r with 0 < r < 2^n for which there exist u,v,w in the x-independent beginning of the Collatz trajectory of 2^n x + r with u+v = w+1, as detailed in the link "Collatz iteration and Euler numbers?". A better understanding of this might also give a formula for A374527. - Markus Sigg, Aug 02 2024
This sequence has a connection to consecutively halved positional voting (CHPV); see Mendenhall and Switkay. - Hal M. Switkay, Feb 25 2025
a(n) is the number of subsets of size 2 and more of an n-element set. Equivalently, a(n) is the number of (hyper)edges of size 2 and more in a complete hypergraph of n vertices. - Yigit Oktar, Apr 05 2025

Examples

			G.f. = x^2 + 4*x^3 + 11*x^4 + 26*x^5 + 57*x^6 + 120*x^7 + 247*x^8 + 502*x^9 + ...
		

References

  • O. Bottema, Problem #562, Nieuw Archief voor Wiskunde, 28 (1980) 115.
  • L. Comtet, "Permutations by Number of Rises; Eulerian Numbers." Section 6.5 in Advanced Combinatorics: The Art of Finite and Infinite Expansions, rev. enl. ed. Dordrecht, Netherlands: Reidel, pp. 51 and 240-246, 1974.
  • F. N. David and D. E. Barton, Combinatorial Chance. Hafner, NY, 1962, p. 151.
  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, p. 34.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 215.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A008292 (classic version of Euler's triangle used by Comtet (1974)).
Cf. A173018 (version of Euler's triangle used by Graham, Knuth and Patashnik in Concrete Math. (1990)).
Cf. A002662 (partial sums).
Partial sums of A000225.
Row sums of A014473 and of A143291.
Second column of triangles A112493 and A112500.
Sequences A125128 and A130103 are essentially the same.
Column k=1 of A124324.

Programs

  • Haskell
    a000295 n = 2^n - n - 1  -- Reinhard Zumkeller, Nov 25 2013
    
  • Magma
    [2^n-n-1: n in [0..40]]; // Vincenzo Librandi, Jul 29 2015
    
  • Magma
    [EulerianNumber(n, 1): n in [0..40]]; // G. C. Greubel, Oct 02 2024
    
  • Maple
    [ seq(2^n-n-1, n=1..50) ];
    A000295 := -z/(2*z-1)/(z-1)**2; # Simon Plouffe in his 1992 dissertation
    # Grammar specification:
    spec := [S, { B = Set(Z, 1 <= card), C = Sequence(B, 2 <= card), S = Prod(B, C) }, unlabeled]:
    struct := n -> combstruct[count](spec, size = n+1);
    seq(struct(n), n = 0..33); # Peter Luschny, Jul 22 2014
  • Mathematica
    a[n_] = If[n==0, 0, n*(HypergeometricPFQ[{1, 1-n}, {2}, -1] - 1)];
    Table[a[n], {n,0,40}] (* Olivier Gérard, Mar 29 2011 *)
    LinearRecurrence[{4, -5, 2}, {0, 0, 1}, 40] (* Vincenzo Librandi, Jul 29 2015 *)
    Table[2^n -n-1, {n,0,40}] (* Eric W. Weisstein, Nov 16 2017 *)
  • PARI
    a(n)=2^n-n-1 \\ Charles R Greathouse IV, Jun 10 2011
    
  • SageMath
    [2^n -(n+1) for n in range(41)] # G. C. Greubel, Oct 02 2024

Formula

a(n) = 2^n - n - 1.
G.f.: x^2/((1-2*x)*(1-x)^2).
A107907(a(n+2)) = A000079(n+2). - Reinhard Zumkeller, May 28 2005
E.g.f.: exp(x)*(exp(x)-1-x). - Emeric Deutsch, Oct 28 2006
a(0)=0, a(1)=0, a(n) = 3*a(n-1) - 2*a(n-2) + 1. - Miklos Kristof, Mar 09 2005
a(0)=0, a(n) = 2*a(n-1) + n - 1 for all n in Z.
a(n) = Sum_{k=2..n} binomial(n, k). - Paul Barry, Jun 05 2003
a(n+1) = Sum_{i=1..n} Sum_{j=1..i} C(i, j). - Benoit Cloitre, Sep 07 2003
a(n+1) = 2^n*Sum_{k=0..n} k/2^k. - Benoit Cloitre, Oct 26 2003
a(0)=0, a(1)=0, a(n) = Sum_{i=0..n-1} i+a(i) for i > 1. - Gerald McGarvey, Jun 12 2004
a(n+1) = Sum_{k=0..n} (n-k)*2^k. - Paul Barry, Jul 29 2004
a(n) = Sum_{k=0..n} binomial(n, k+2); a(n+2) = Sum_{k=0..n} binomial(n+2, k+2). - Paul Barry, Aug 23 2004
a(n) = Sum_{k=0..floor((n-1)/2)} binomial(n-k-1, k+1)*2^(n-k-2)*(-1/2)^k. - Paul Barry, Oct 25 2004
a(0) = 0; a(n) = Stirling2(n,2) + a(n-1) = A000225(n-1) + a(n-1). - Thomas Wieder, Feb 18 2007
a(n) = A000325(n) - 1. - Jonathan Vos Post, Aug 29 2008
a(0) = 0, a(n) = Sum_{k=0..n-1} 2^k - 1. - Doug Bell, Jan 19 2009
a(n) = A000217(n-1) + A002662(n) for n>0. - Geoffrey Critzer, Feb 11 2009
a(n) = A000225(n) - n. - Zerinvary Lajos, May 29 2009
a(n) = n*(2F1([1,1-n],[2],-1) - 1). - Olivier Gérard, Mar 29 2011
Column k=1 of A173018 starts a'(n) = 0, 1, 4, 11, ... and has the hypergeometric representation n*hypergeom([1, -n+1], [-n], 2). This can be seen as a formal argument to prefer Euler's A173018 over A008292. - Peter Luschny, Sep 19 2014
E.g.f.: exp(x)*(exp(x)-1-x); this is U(0) where U(k) = 1 - x/(2^k - 2^k/(x + 1 - x^2*2^(k+1)/(x*2^(k+1) - (k+1)/U(k+1)))); (continued fraction, 3rd kind, 4-step). - Sergei N. Gladkovskii, Dec 01 2012
a(n) = A079583(n) - A000225(n+1). - Miquel Cerda, Dec 25 2016
a(0) = 0; a(1) = 0; for n > 1: a(n) = Sum_{i=1..2^(n-1)-1} A001511(i). - David Siegers, Feb 26 2019
a(n) = A007814(A028366(n)). - Franz Vrabec, Aug 18 2023
a(n) = Sum_{k=1..floor((n+1)/2)} binomial(n+1, 2*k+1). - Taras Goy, Jan 02 2025

A015910 a(n) = 2^n mod n.

Original entry on oeis.org

0, 0, 2, 0, 2, 4, 2, 0, 8, 4, 2, 4, 2, 4, 8, 0, 2, 10, 2, 16, 8, 4, 2, 16, 7, 4, 26, 16, 2, 4, 2, 0, 8, 4, 18, 28, 2, 4, 8, 16, 2, 22, 2, 16, 17, 4, 2, 16, 30, 24, 8, 16, 2, 28, 43, 32, 8, 4, 2, 16, 2, 4, 8, 0, 32, 64, 2, 16, 8, 44, 2, 64, 2, 4, 68, 16, 18, 64, 2, 16, 80, 4, 2, 64
Offset: 1

Views

Author

Keywords

Comments

2^n == 2 mod n if and only if n is a prime or a member of A001567 or of A006935. [Guy]. - N. J. A. Sloane, Mar 22 2012; corrected by Thomas Ordowski, Mar 26 2016
Known solutions to 2^n == 3 (mod n) are given in A050259.
This sequence is conjectured to include every integer k >= 0 except k = 1. A036236 includes a proof that k = 1 is not in this sequence, and n = A036236(k) solves a(n) = k for all other 0 <= k <= 1000. - David W. Wilson, Oct 11 2011
It could be argued that a(0) := 1 would make sense, e.g., thinking of "mod n" as "in Z/nZ", and/or because (anything)^0 = 1. See also A112987. - M. F. Hasler, Nov 09 2018

Examples

			a(7) = 2 because 2^7 = 128 = 2 mod 7.
a(8) = 0 because 2^8 = 256 = 0 mod 8.
a(9) = 8 because 2^9 = 512 = 8 mod 9.
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, F10.

Crossrefs

Programs

Formula

a(2^k) = 0. - Alonso del Arte, Nov 10 2014
a(n) == 2^(n-phi(n)) mod n, where phi(n) = A000010(n). - Thomas Ordowski, Mar 26 2016

A062173 a(n) = 2^(n-1) mod n.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 1, 0, 4, 2, 1, 8, 1, 2, 4, 0, 1, 14, 1, 8, 4, 2, 1, 8, 16, 2, 13, 8, 1, 2, 1, 0, 4, 2, 9, 32, 1, 2, 4, 8, 1, 32, 1, 8, 31, 2, 1, 32, 15, 12, 4, 8, 1, 14, 49, 16, 4, 2, 1, 8, 1, 2, 4, 0, 16, 32, 1, 8, 4, 22, 1, 32, 1, 2, 34, 8, 9, 32, 1, 48, 40, 2, 1, 32, 16, 2, 4, 40, 1, 32, 64, 8, 4, 2, 54, 32, 1, 58, 58, 88, 1, 32, 1, 24, 46
Offset: 1

Views

Author

Henry Bottomley, Jun 12 2001

Keywords

Comments

If p is an odd prime then a(p)=1. However, a(n) is also 1 for pseudoprimes to base 2 such as 341.

Examples

			a(5) = 2^(5-1) mod 5 = 16 mod 5 = 1.
		

Crossrefs

Cf. A176997 (after the initial term, gives the positions of ones).

Programs

  • Haskell
    import Math.NumberTheory.Moduli (powerMod)
    a062173 n = powerMod 2 (n - 1) n  -- Reinhard Zumkeller, Oct 17 2015
    
  • Magma
    [Modexp(2,n-1,n): n in [1..110]]; // G. C. Greubel, Jan 11 2023
    
  • Mathematica
    Array[Mod[2^(# - 1), #] &, 105] (* Michael De Vlieger, Jul 01 2018 *)
    Array[PowerMod[2,#-1,#]&,120] (* Harvey P. Dale, May 17 2023 *)
  • PARI
    A062173(n) = if(1==n, 0, lift(Mod(2, n)^(n-1))); \\ Antti Karttunen, Jul 01 2018
    
  • SageMath
    [power_mod(2,n-1,n) for n in range(1,110)] # G. C. Greubel, Jan 11 2023

Formula

a(n) = A106262(2*n-3, n-2). - G. C. Greubel, Jan 11 2023

Extensions

More terms from Antti Karttunen, Jul 01 2018

A082482 a(n) = floor of (2^n-1)/n.

Original entry on oeis.org

1, 1, 2, 3, 6, 10, 18, 31, 56, 102, 186, 341, 630, 1170, 2184, 4095, 7710, 14563, 27594, 52428, 99864, 190650, 364722, 699050, 1342177, 2581110, 4971026, 9586980, 18512790, 35791394, 69273666, 134217727, 260301048, 505290270, 981706810
Offset: 1

Views

Author

Jon Perry, Apr 27 2003

Keywords

Comments

a(n) is the largest exponent k such that (2^n)^k || (2^n)!. - Lekraj Beedassy, Jan 15 2024

Examples

			a(3) = floor((2^3-1)/3) = floor(7/3) = floor(2.333) = 2.
		

Crossrefs

a(n) = A053638(n) - 1.

Programs

  • Maple
    seq(floor((2^n-1)/n), n=1..100); # Robert Israel, Dec 01 2016
  • PARI
    for (n=1,50,print1(floor((2^n-1)/n)","))

Formula

a(n) = (2^n - 1 - A082495(n))/n = A162214(n)/n. - Robert Israel, Dec 01 2016

A096196 a(n) = (1 + 2^n) mod n.

Original entry on oeis.org

0, 1, 0, 1, 3, 5, 3, 1, 0, 5, 3, 5, 3, 5, 9, 1, 3, 11, 3, 17, 9, 5, 3, 17, 8, 5, 0, 17, 3, 5, 3, 1, 9, 5, 19, 29, 3, 5, 9, 17, 3, 23, 3, 17, 18, 5, 3, 17, 31, 25, 9, 17, 3, 29, 44, 33, 9, 5, 3, 17, 3, 5, 9, 1, 33, 65, 3, 17, 9, 45, 3, 65, 3, 5, 69, 17, 19, 65, 3, 17, 0, 5, 3, 65, 33, 5, 9, 81, 3
Offset: 1

Views

Author

Labos Elemer, Jul 26 2004

Keywords

Crossrefs

Programs

A094918 a(n) = (3^n-1)/2 mod n.

Original entry on oeis.org

0, 0, 1, 0, 1, 4, 1, 0, 4, 4, 1, 4, 1, 4, 13, 0, 1, 4, 1, 0, 13, 4, 1, 16, 21, 4, 13, 12, 1, 4, 1, 0, 13, 4, 23, 4, 1, 4, 13, 0, 1, 28, 1, 40, 31, 4, 1, 16, 15, 24, 13, 40, 1, 40, 33, 32, 13, 4, 1, 40, 1, 4, 13, 0, 56, 34, 1, 40, 13, 54, 1, 40, 1, 4, 28, 40, 37, 52, 1, 0, 40, 4, 1, 28, 36, 4, 13, 24
Offset: 1

Views

Author

N. J. A. Sloane, Jun 18 2004

Keywords

Crossrefs

(k^n-1)/(k-1) mod n for k = 1, ..., 10 gives A082495, this sequence, A094919, A094920, A094921, A094922, A094923, A094924 and A095250.
Cf. A003462.

Programs

A357531 Final value obtained by traveling clockwise around a circular array with positions numbered clockwise from 1 to n. Each move consists of traveling clockwise k places, where k is the position at the beginning of the move. The first move begins at position 1. a(n) is the position at the end of the n-th move.

Original entry on oeis.org

1, 2, 2, 4, 2, 4, 2, 8, 8, 4, 2, 4, 2, 4, 8, 16, 2, 10, 2, 16, 8, 4, 2, 16, 7, 4, 26, 16, 2, 4, 2, 32, 8, 4, 18, 28, 2, 4, 8, 16, 2, 22, 2, 16, 17, 4, 2, 16, 30, 24, 8, 16, 2, 28, 43, 32, 8, 4, 2, 16, 2, 4, 8, 64, 32, 64, 2, 16, 8, 44, 2, 64, 2, 4, 68, 16, 18, 64, 2, 16, 80, 4, 2, 64, 32, 4, 8, 80
Offset: 1

Views

Author

Moosa Nasir, Nov 19 2022

Keywords

Comments

This is only an empirical observation, but when we graph this sequence, a point always exists at the intersection of y = 2^b and y = -x + 2^(b+1), where b is any integer greater than or equal to 1. This means that a(2^b) = 2^b. This is shown in a link.
Many of the terms seem to be of the form 2^b.

Examples

			For n = 5, with a circular array of positions numbered clockwise from 1 to 5, start at position 1.
On move 1, travel 1 unit clockwise, reaching position 2.
On move 2, travel 2 units clockwise, reaching position 4.
On move 3, travel 4 units clockwise (almost a full circle), reaching position 3.
On move 4, travel 3 units clockwise, reaching position 1.
On move 5, travel 1 unit clockwise, reaching position 2.
Since the final position at the end of the 5th move is 2, a(5) = 2. (See the illustration in the links.)
		

Crossrefs

Cf. A358647 (stepping in digits of n).
Equals {A082495} + 1. - Hugo Pfoertner, Nov 30 2022

Programs

  • C
    int a(int n)
    {
        int current = 1;
        for (int j = 0; j < n; j++) {
            current += current;
            if (current > n) {
                current = current - n;
            }
        }
        return current;
    }
    
  • PARI
    a(n) = lift(Mod(2,n)^n - 1) + 1; \\ Kevin Ryde, Nov 20 2022
    
  • Python
    def A357531(n): return m if (m:=pow(2,n,n)) else n # Chai Wah Wu, Dec 01 2022

Formula

a(n) = ((2^n - 1) mod n) + 1 = A082495(n) + 1. - Jon E. Schoenfield, Nov 20 2022

A096197 a(n) = (1+prime(n)) mod n.

Original entry on oeis.org

0, 0, 0, 0, 2, 2, 4, 4, 6, 0, 10, 2, 3, 2, 3, 6, 9, 8, 11, 12, 11, 14, 15, 18, 23, 24, 23, 24, 23, 24, 4, 4, 6, 4, 10, 8, 10, 12, 12, 14, 16, 14, 20, 18, 18, 16, 24, 32, 32, 30, 30, 32, 30, 36, 38, 40, 42, 40, 42, 42, 40, 46, 56, 56, 54, 54, 64, 66, 3, 0, 70, 0, 3, 4, 5, 4, 5, 8, 7, 10, 15
Offset: 1

Views

Author

Labos Elemer, Jul 26 2004

Keywords

Comments

Graph is similar to that of A004648.

Crossrefs

Programs

  • Magma
    [(NthPrime(n)+1) mod(n): n in [1..90]]; // Vincenzo Librandi, Sep 11 2014
    
  • Mathematica
    Table[Mod[Prime[n] + 1, n], {n, 100}] (* Vincenzo Librandi, Sep 11 2014 *)
  • PARI
    lista(nn) = {forprime(p=2, n, print1((p+1) % primepi(p), ", "););} \\ Michel Marcus, Sep 11 2014

A192324 Sequence of numbers formed as remainder of Mersenne numbers divided by primes.

Original entry on oeis.org

1, 0, 2, 1, 9, 11, 8, 8, 5, 8, 1, 25, 32, 0, 8, 27, 32, 26, 12, 47, 7, 35, 46, 3, 94, 19, 75, 61, 22, 3, 7, 116, 67, 24, 137, 63, 149, 42, 60, 9, 71, 155, 39, 11, 72, 50, 47, 40, 23, 25, 70, 47, 31, 15, 127, 172, 73, 109, 117, 58, 29, 246, 201, 207, 283, 52, 127, 31, 138, 55, 284, 23
Offset: 1

Views

Author

Pasi Airikka, Jun 28 2011

Keywords

Comments

Exponent of Mersenne number formula does not have to be a prime.

Examples

			a(1) = mod(mersenne(1)/prime(1)) = mod(1/2) = 1
a(2) = mod(mersenne(2)/prime(2)) = mod(3/3) = 0
a(3) = mod(mersenne(3)/prime(3)) = mod(7/5) = 2
a(4) = mod(mersenne(4)/prime(4)) = mod(15/7) = 1
a(5) = mod(mersenne(5)/prime(5)) = mod(31/11) = 9
		

Crossrefs

Cf. A000225 (Mersenne), A000040 (prime), A082495.

Programs

  • MATLAB
    % n = number of computed terms of sequence
    for i=1:n,
        a(i) = mod(mersenne(i),prime(i)) ;
    end
    
  • PARI
    a(n) = (2^n-1)%prime(n)
    
  • PARI
    a(n)=lift(Mod(2,prime(n))^n-1) \\ Charles R Greathouse IV, Jun 29 2011

Formula

a(n) = mod (mersenne(n) / prime(n))
where mersenne(n) returns n-th mersenne number and, correspondingly, prime(n) returns n-th prime number.
Showing 1-9 of 9 results.