login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A262222 Decimal representations of hexadecimal numbers that can be misinterpreted as decimal numbers in scientific E notation. 1
480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Hexadecimal numbers containing no alpha digits other than a single "e", where the "e" is not the first or last digit (e.g., 3e12), may be misinterpreted as numbers in scientific E notation.

These numbers are especially troublesome when importing hexadecimal numbers from CSV files into Microsoft Excel.

These numbers can be written as 16^(i+1)a + 14*16^i + b where a and b are members of A102489 with a>0, b<16^i and i>0.

LINKS

Christian Perfect, Table of n, a(n) for n = 1..99999

Microsoft Community, Unable to disable scientific notation in Microsoft Excel.

Wikipedia, Scientific E notation.

EXAMPLE

480_10 = 1e0_16 and 1e0 = 1 in E notation.

739_10 = 2e3_16 and 2e3 = 2000_10 in E notation.

PROG

(C++)

#include <iostream>

#include <string>

using namespace std;

int main()

{

  int n = 0;                  //integer to check

  char hexRepresentation[12];

  for (int i = 0; i < 100; )   //integers found (first 100)

  {

    sprintf(hexRepresentation, "%x", n);              //get hex representation

    char* foundE = strchr(hexRepresentation, 'e');    //look for letter e

    if (foundE != NULL &&                             //at least one e

    hexRepresentation != foundE &&                    //not the first digit

    strpbrk(hexRepresentation, "abcdef") == foundE && //e is not first alpha

    strlen(foundE) != 1 &&                            //something after the e

    strpbrk(foundE + sizeof(char), "abcdef") == NULL) //no alpha after the e

    {

      cout << n << "\n";    //output n

      i++;                  //discovered an integer

    }

    n++;                    //check next value

  }

}

(Python)

from itertools import count, product

.

# every string of d characters with exactly one 'e' in it, and all the other characters digits 0-9, in ascending lexicographic order

def mids(d):

...if d<1:

......raise Exception("d<1")

...if d==1:

......yield 'e'

......return

...for i in range(0, 10):

......for m in mids(d-1):

.........yield str(i)+m

...for i in range(10**(d-1)):

......yield 'e'+str(i).zfill(d-1)

.

def a_generator():

...for d in count(1):

......for start in range(1, 10): # for each leading digit 1-9

.........for mid in mids(d): # for all possible middles made of d characters, containing exactly one 'e'

............for end in range(0, 10): #for each possible final digit, 0-9

...............s = '{}{}{}'.format(start, ''.join(mid), end)

...............i = int(s, 16)

...............yield i

.

a262222 = a_generator()

[a262222.next() for _ in range(48)] # Christian Perfect, Oct 20 2015

CROSSREFS

A subset of A102490.

Sequence in context: A056987 A025025 A108256 * A115157 A019287 A258551

Adjacent sequences:  A262219 A262220 A262221 * A262223 A262224 A262225

KEYWORD

nonn,base

AUTHOR

Adam J.T. Partridge, Sep 16 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified February 20 14:37 EST 2018. Contains 299380 sequences. (Running on oeis4.)