[go: up one dir, main page]

login
Search: a078197 -id:a078197
     Sort: relevance | references | number | modified | created      Format: long | short | data
Position of the start of the first occurrence of n after the decimal point in Pi = 3.14159265358979323846264338327950288...
+10
44
32, 1, 6, 9, 2, 4, 7, 13, 11, 5, 49, 94, 148, 110, 1, 3, 40, 95, 424, 37, 53, 93, 135, 16, 292, 89, 6, 28, 33, 186, 64, 137, 15, 24, 86, 9, 285, 46, 17, 43, 70, 2, 92, 23, 59, 60, 19, 119, 87, 57, 31, 48, 172, 8, 191, 130, 210, 404, 10, 4, 127, 219, 20, 312, 22, 7, 117, 98, 605
OFFSET
0,1
COMMENTS
This is A037008(1), A037000(1), A037001(1), A037002(1), A037003(1), A037004(1), A037005(1), A036974(1), A037006(1), A037007(1) etc.
LINKS
Ronald R. King and T. D. Noe, Table of n, a(n) for n = 0..9999
Dave Andersen, The Pi-Search Page.
Tom Crawford and Brady Haran, Strings and Loops within Pi, Numberphile video (2020)
Anders Hellström, Sage program, Feb 02 2017
EXAMPLE
In the decimal expansion of Pi, the string "0" is found at position 32 counting from the first digit after the decimal point. The string "1" is found at position 1, the string "2" at position 6, the string "3" at position 9, etc.
MATHEMATICA
Table[-1 + SequencePosition[#, IntegerDigits@ n][[1, 1]], {n, 0, 68}] &@ First@ RealDigits@ N[Pi, 10^4] (* Michael De Vlieger, Aug 10 2016, Version 10.1 *)
PROG
(Magma) k := 700; R := RealField(k); [ Position(IntegerToString(Round(10^k*(-3 + Pi(R)))), IntegerToString(n)) : n in [0..68] ]; /* Klaus Brockhaus, Feb 15 2007 */
(PARI) M14777=Map(); A014777(n)={iferr(mapget(M14777, n), E, my(i=if(n>9, A014777(n\10), 1), d=if(n, digits(n), [0]), j); while(i++, j=#d; until(!j, d[j]==A000796(i+j--) || next(2)); break); mapput(M14777, n, i--); i)} \\ M. F. Hasler, Jun 21 2022
(Python)
from mpmath import mp
def A014777(n):
if not (i := A014777.pos.get(n, 0)):
d = str(n); s = 2 # starting position for search
while (i := A014777.pi.find(d, s)) < 1:
s = max(len(A014777.pi) - len(d), 2)
with mp.workdps(s + 99 if s < 500 else s*6//5): # new precision
A014777.pi = str(mp.pi - 5/mp.mpf(10)**mp.dps) # don't round
i -= 1; A014777.pos[n] = i
return i
A014777.pi = ''; A014777.pos = {} # M. F. Hasler, Jun 21 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paul Simon (paulsimn(AT)microtec.net) and Simon Plouffe
EXTENSIONS
More terms from Klaus Brockhaus, Feb 15 2007
STATUS
approved
a(1)=0; for i>=1, a(i+1)=position of first occurrence of a(i) in decimal expansion of e.
+10
14
0, 13, 27, 62, 32, 110, 3188, 12078, 141356, 2085932, 3497082, 4910326, 929922, 1189814, 4196683, 1301478, 19560712, 6894489, 41960008
OFFSET
0,2
COMMENTS
Recurrence sequence based on positions of digits in decimal places of e.
EXAMPLE
So for example, a(2)=13 because 13th digit of e after decimal point is 0.
a(3)=27 because 27th decimal digit of e is 13, a(4)=62 because 62nd to 63rd decimal digits of e form "13" and so on.
CROSSREFS
Cf. A078197 for the first occurrence of integers in decimal digits of e; A097614 for the analogous recurrence sequence for Pi, also A014777 for positions of integers in decimal digits of Pi.
KEYWORD
easy,base,nonn
AUTHOR
Mark Hudson (mrmarkhudson(AT)hotmail.com), Sep 01 2004
EXTENSIONS
More terms from Ben Ross (bmr180(AT)psu.edu), Feb 01 2006
STATUS
approved
a(n) is the position of the start of the first occurrence of n > a(n-1) after the decimal point in Pi = 3.14159265358979323846264338327950288...
+10
4
1, 6, 9, 19, 31, 41, 47, 52, 55, 163, 174, 220, 281, 295, 314, 396, 428, 446, 495, 600, 650, 661, 698, 803, 822, 841, 977, 1090, 1124, 1358, 1435, 1501, 1667, 1668, 1719, 1828, 1926, 1968, 1987, 2007, 2161, 2210, 2236, 2261, 2305, 2416, 2509, 2555, 2595
OFFSET
1,2
COMMENTS
The digits at position 1667 are "334", so according to the strict definition of this sequence, a(33) is 1667 and a(34) is 1668. However, this would not enable a person to mark in bold-face the counting numbers within the digits of pi, which was the inspiration for this sequence. Surprisingly, if overlapping is not allowed, this changes only one element of the sequence. a(34) becomes 1700 and a(35) remains 1719. No other overlapping occurs within the first 100,000 decimal digits of Pi. - Graeme McRae, Mar 20 2005
LINKS
Dave Andersen, The Pi-Search Page.
EXAMPLE
Moving always to the right in the decimal expansion of Pi, the string "1" is found at position 1 counting from the first digit after the decimal point, the string "2" is found at position 6, the string "3" at position 6, the string "4" at position 19, etc.
MATHEMATICA
p = ToString[ FromDigits[ RealDigits[ N[Pi - 3, 2600]][[1]]]]; lst = {0}; Do[a = StringPosition[p, ToString[n], 1][[1, 1]]; AppendTo[lst, a + lst[[ -1]]]; p = StringDrop[p, a], {n, 49}]; Rest[lst] (* Robert G. Wilson v, Mar 19 2005 *)
PROG
(Magma) k := 3000; R := RealField(k); S := IntegerToString(Round(10^k*(-3 + Pi(R)))); Q := []; d := 0; for n in [1..49] do p:= Position(S, IntegerToString(n)); d+:=p; Append(~Q, d); S := Substring(S, p+1, #S-p); end for; Q; /* Klaus Brockhaus, Feb 15 2007 */
(PARI) lista(nn, t=10^5) = {default(realprecision, t); my(d, k, v=digits(floor(Pi*10^t))); for(n=1, nn, d=digits(n); until(v[k+1..k+#d]==d, k++); print1(k, ", ")); } \\ Jinyuan Wang, Feb 18 2021
CROSSREFS
Cf. A000796, A078197, A014777 (another version).
KEYWORD
nonn,base,easy
AUTHOR
Suggested by Bob's Poetry Page. - Alonso del Arte, Mar 01 2005
EXTENSIONS
More terms from Graeme McRae and Robert G. Wilson v, Mar 19 2005
STATUS
approved
Numbers k such that k > first location of string of k in decimal expansion of e.
+10
2
7, 8, 18, 23, 28, 35, 36, 45, 47, 49, 52, 53, 57, 59, 60, 62, 66, 67, 69, 70, 71, 72, 74, 75, 76, 77, 81, 82, 84, 87, 90, 93, 94, 95, 96, 97, 99, 135, 138, 166, 174, 178, 181, 182, 193, 195, 200, 217, 218, 232, 233, 235, 240, 244, 247, 249, 251, 260, 264, 266
OFFSET
1,1
COMMENTS
'Location' starts from the first digit after the decimal point and refers to the first digit of a(n).
LINKS
Robert Nemiroff and Jerry Bonnell, The Number e to 1 Million Digits.
FORMULA
a(n) > A078197(n). - Michael S. Branicky, Jul 10 2022
EXAMPLE
1 is not a term since it is less than its location in e, 2.
7 is a term since it is greater than its location in e, 1.
18 is a term since it is greater than its location in e, 2.
PROG
(Python)
from sympy import E
from itertools import count, islice
digits_of_e = str(E.n(10**5))[1:-1] # raise to 10**6 for b-file
def agen():
for k in count(1):
kloc = digits_of_e.find(str(k))
assert kloc > 0, ("Increase precision", k)
if k > kloc: yield k
print(list(islice(agen(), 60))) # Michael S. Branicky, Jul 10 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leonid Ianoushevitch (leonid163(AT)mail.ru), Oct 24 2008
EXTENSIONS
Terms corrected and a(45) and beyond from Michael S. Branicky, Jul 10 2022
STATUS
approved
Position of the first occurrence of n in the decimal expansion of e.
+10
1
13, 2, 0, 17, 10, 11, 20, 1, 3, 12, 195, 200, 370, 27, 223, 201, 94, 88, 2, 108, 111, 87, 252, 16, 33, 92, 30, 0, 4, 131, 71, 189, 110, 142, 143, 17, 19, 270, 85, 106, 66, 124, 97, 134, 239, 10, 103, 25, 228, 34, 235, 93, 15, 18, 76, 301, 153, 38, 325, 11, 20, 242, 32
OFFSET
0,1
COMMENTS
The 2 before the decimal point is counted as position 0.
This differs from A078197(n) at n = 2, 27, 271, 2718, ... .
MATHEMATICA
With[{ed=RealDigits[E, 10, 500][[1]]}, Flatten[Table[SequencePosition[ ed, IntegerDigits[n], 1][[All, 1]], {n, 0, 65}]]]-1 (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 06 2017 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Bobby Jacobs, Jan 21 2017
STATUS
approved
Position of first occurrence of n after the decimal point in the decimal expansion of 1/Pi.
+10
0
5, 2, 26, 1, 29, 19, 9, 13, 3, 6, 297, 64, 50, 385, 45, 18, 116, 65, 2, 41, 393, 102, 85, 125, 35, 93, 26, 86, 32, 43, 4, 1, 92, 58, 59, 69, 126, 12, 165, 151, 36, 717, 437, 196, 226, 29, 60, 160, 46, 55, 30, 112, 25, 19, 108, 90, 105, 134, 123, 70, 88, 9, 446, 149, 236, 511
OFFSET
0,1
COMMENTS
a(0) = A133268(1),
a(1) = A134251(1),
a(2) = A134252(1),
a(3) = A134253(1),
a(4) = A134254(1),
a(5) = A134255(1),
a(6) = A134256(1),
a(7) = A134257(1),
a(8) = A134258(1),
a(9) = A134259(1),
a(10) = A134260(1). - Artur Jasinski, Oct 16 2007
EXAMPLE
1/Pi = 0.31830988618379067153776752674... so the first occurrence of 0 after the decimal point is at position 5; first occurrence of 1 is at position 2; first occurrence of 2 is at position 26; etc.
MATHEMATICA
Table[ SequencePosition[#, IntegerDigits@ n][[1, 1]], {n, 0, 65}] &@ First@ RealDigits@ N[1/Pi, 10^4] (* James C. McMahon, Feb 06 2024 *)
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Mark Hudson (mrmarkhudson(AT)hotmail.com), Nov 03 2004
EXTENSIONS
Edited by N. J. A. Sloane, Jun 30 2008 at the suggestion of R. J. Mathar
STATUS
approved
a(n) is the position of the first occurrence of n > a(n-1) after the decimal point in e = 2.71828182845904523...
+10
0
2, 4, 17, 25, 29, 31, 36, 86, 107, 195, 200, 370, 687, 853, 880, 899, 961, 963, 1013, 1153, 1161, 1235, 1263, 1291, 1325, 1347, 1357, 1399, 1444, 1451, 1798, 1846, 2067, 2191, 2258, 2305, 2332, 2356, 2370, 2487, 2516, 2571, 2578, 2690, 2694, 2807, 2926, 2956, 3012
OFFSET
1,1
EXAMPLE
Moving always to the right in the decimal expansion of e, the string "1" is found at position 2 counting from the first digit after the decimal point, the string "2" is found at position 4, the string "3" at position 17, the string "4" at position 25, etc.
MATHEMATICA
p = ToString[FromDigits[RealDigits[N[E - 2, 2600]][[1]]]]; lst = {0}; Do[
a = StringPosition[p, ToString[n], 1][[1, 1]]; AppendTo[lst, a + lst[[-1]]];
p = StringDrop[p, a], {n, 29}]; Rest[lst]
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Philipp O. Tsvetkov, Jul 29 2018
STATUS
approved
a(n) is the position of the start of the first occurrence of prime(n) after the decimal point in the expansion of e.
+10
0
4, 17, 11, 1, 200, 27, 88, 108, 16, 131, 189, 270, 124, 134, 25, 18, 11, 242, 59, 1, 157, 168, 205, 221, 35, 195, 941, 283, 1748, 355, 370, 4604, 1574, 1998, 223, 413, 201, 483, 232, 599, 2875, 120, 1382, 108, 607, 1067, 426, 2494, 1329, 517, 178, 574, 2133
OFFSET
1,1
FORMULA
a(n) = A078197(prime(n)). - Rémy Sigrist, Feb 12 2021
EXAMPLE
The first position at which prime(1)=2 occurs to the right of the decimal point in e=2.71828... is the 4th digit after the decimal point, so a(1)=4.
MATHEMATICA
en=Characters[ToString@N[E, 10000]];
For[x=1, x<=100, x++, Print["x=", x, " ", prn=Prime[x], " ", pos=First[SequencePosition[en, Characters[ToString[prn]]]-2]]]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Gregory Allen, Feb 11 2021
STATUS
approved
The location of the first occurrence of n in the decimal expansion of phi (the golden ratio, 1.6180339887...).
+10
0
4, 0, 19, 5, 11, 22, 1, 10, 3, 7, 231, 34, 121, 55, 254, 366, 0, 35, 2, 188, 19, 54, 62, 131, 78, 213, 67, 63, 51, 174, 40, 137, 181, 5, 26, 56, 28, 98, 32, 6, 105, 90, 347, 27, 58, 21, 70, 102, 15, 11, 214, 394, 66, 111, 57, 768, 30, 48, 22, 166, 68, 1, 50
OFFSET
0,1
COMMENTS
Locations in the expansion of phi are numbered 0 for the digit before the decimal point, 1 for the first digit after the decimal point, and so on.
FORMULA
a(n) = A088577(n) - 1.
EXAMPLE
The first occurrence of 0 in phi occurs 4 places after the decimal point, so a(0)=4; 5 first occurs 22 places after the decimal point, so a(5)=22; 10 first occurs 231 places after the decimal point so a(10)=231.
MATHEMATICA
Table[-1 + SequencePosition[#, IntegerDigits@ n][[1, 1]], {n, 0, 50}] &@ First@ RealDigits@ N[GoldenRatio, 10^4]
CROSSREFS
Cf. A001622 (phi)
Cf. A088577 (1-based locations).
Cf. A078197 (for e), A176341 (for Pi), A014777 (for Pi but different indexing).
KEYWORD
nonn,base
AUTHOR
James C. McMahon, Apr 06 2023
STATUS
approved

Search completed in 0.010 seconds